mirror of
https://github.com/vercel/commerce.git
synced 2025-05-18 07:26:59 +00:00
fix: Customer request without customerId
This commit is contained in:
parent
16a9862b53
commit
1cb1824af1
@ -14,14 +14,15 @@ export const handler: SWRHook<CustomerHook> = {
|
|||||||
method: 'GET',
|
method: 'GET',
|
||||||
},
|
},
|
||||||
async fetcher({ options, fetch }) {
|
async fetcher({ options, fetch }) {
|
||||||
const data = await fetch({...options})
|
const data: any = customerId ? await fetch({ ...options }) : null
|
||||||
|
|
||||||
return data ? ({
|
return data
|
||||||
firstName: '',
|
? ({
|
||||||
lastName: '',
|
firstName: '',
|
||||||
email: data.attributes.email ?? '',
|
lastName: '',
|
||||||
} as any)
|
email: data.attributes.email ?? '',
|
||||||
: null
|
} as any)
|
||||||
|
: null
|
||||||
},
|
},
|
||||||
|
|
||||||
useHook:
|
useHook:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user