From 1af12587f36d71c38f8a97c1f062616d812865ff Mon Sep 17 00:00:00 2001 From: Luan Rafael Pinheiro Date: Thu, 5 Oct 2023 14:04:40 -0300 Subject: [PATCH] Refactor: Use 'login' for authentication instead of 'email' in registration process Issue #1464 --- packages/commerce-sdk-react/src/auth/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/commerce-sdk-react/src/auth/index.ts b/packages/commerce-sdk-react/src/auth/index.ts index 8a9ec29d1c..c405ed3cb8 100644 --- a/packages/commerce-sdk-react/src/auth/index.ts +++ b/packages/commerce-sdk-react/src/auth/index.ts @@ -455,15 +455,15 @@ class Auth { */ async register(body: ShopperCustomersTypes.CustomerRegistration) { const { - customer: {email}, + customer: {login}, password } = body - // email is optional field from isomorphic library + // login is optional field from isomorphic library // type CustomerRegistration // here we had to guard it to avoid ts error - if (!email) { - throw new Error('Customer registration is missing email address.') + if (!login) { + throw new Error('Customer registration is missing login field.') } const res = await this.shopperCustomersClient.registerCustomer({ @@ -472,7 +472,7 @@ class Auth { }, body }) - await this.loginRegisteredUserB2C({username: email, password}) + await this.loginRegisteredUserB2C({username: login, password}) return res }