Skip to content

Commit ee4cbef

Browse files
committed
Replace instances of pendingToken with auth.ready()
1 parent 94ed269 commit ee4cbef

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

packages/template-retail-react-app/app/commerce-api/hooks/useCustomer.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,7 @@ export default function useCustomer() {
9090
* @param {string} credentials.password
9191
*/
9292
async login(credentials) {
93-
if (api.auth.pendingToken) {
94-
await api.auth.pendingToken
95-
}
93+
await api.auth.ready()
9694
let skeletonCustomer = getSkeletonCustomer()
9795
if (credentials) {
9896
await login.mutateAsync({
@@ -118,7 +116,7 @@ export default function useCustomer() {
118116
*/
119117
async logout() {
120118
await logout.mutateAsync()
121-
await this.login()
119+
await api.auth.ready()
122120
const skeletonCustomer = getSkeletonCustomer()
123121
setCustomer(skeletonCustomer)
124122
},

packages/template-retail-react-app/app/commerce-api/index.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,6 @@ class CommerceAPI {
161161
...fetchOptions?.parameters
162162
}
163163

164-
if (self.auth.pendingToken) {
165-
await self.auth.pendingToken
166-
}
167-
168164
// Handle auth logic (replacing willSendRequest functionality)
169165
let dwsidHeader = {}
170166
const dwsid = self.auth.get('dwsid')

0 commit comments

Comments
 (0)