Skip to content

Commit

Permalink
Refactor: Use 'login' for authentication instead of 'email' in regist…
Browse files Browse the repository at this point in the history
…ration process

Issue SalesforceCommerceCloud#1464
  • Loading branch information
luanrafaelpinheiro committed Oct 5, 2023
1 parent 12796d9 commit 1af1258
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/commerce-sdk-react/src/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -472,7 +472,7 @@ class Auth {
},
body
})
await this.loginRegisteredUserB2C({username: email, password})
await this.loginRegisteredUserB2C({username: login, password})
return res
}

Expand Down

0 comments on commit 1af1258

Please sign in to comment.