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 }