mirror of
https://github.com/vercel/commerce.git
synced 2025-06-19 13:41:22 +00:00
Update use-customer.tsx
This commit is contained in:
parent
894c6a5a3f
commit
e2cd4128c6
@ -10,11 +10,15 @@ export const handler: SWRHook<Customer | null> = {
|
|||||||
query: getCustomerQuery,
|
query: getCustomerQuery,
|
||||||
},
|
},
|
||||||
async fetcher({ options, fetch }) {
|
async fetcher({ options, fetch }) {
|
||||||
const data = await fetch<any | null>({
|
const customerAccessToken = getCustomerToken()
|
||||||
|
if (customerAccessToken) {
|
||||||
|
const data = await fetch({
|
||||||
...options,
|
...options,
|
||||||
variables: { customerAccessToken: getCustomerToken() },
|
variables: { customerAccessToken: getCustomerToken() },
|
||||||
})
|
})
|
||||||
return data.customer ?? null
|
return data.customer
|
||||||
|
}
|
||||||
|
return null
|
||||||
},
|
},
|
||||||
useHook: ({ useData }) => (input) => {
|
useHook: ({ useData }) => (input) => {
|
||||||
return useData({
|
return useData({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user