fix: Customer request without customerId

This commit is contained in:
Alessandro Casazza 2021-09-28 16:32:48 +02:00
parent 16a9862b53
commit 1cb1824af1
No known key found for this signature in database
GPG Key ID: 3AF41B06C6495D3D
2 changed files with 9 additions and 8 deletions

View File

@ -14,9 +14,10 @@ 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: '', firstName: '',
lastName: '', lastName: '',
email: data.attributes.email ?? '', email: data.attributes.email ?? '',