mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
normalize data output in use-customer
Signed-off-by: Loan Laux <loan@outgrow.io>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import useCustomer, { UseCustomer } from '@commerce/customer/use-customer'
|
||||
import { Customer } from '@commerce/types'
|
||||
import { SWRHook } from '@commerce/utils/types'
|
||||
import { viewerQuery } from '../utils'
|
||||
import { viewerQuery, normalizeCustomer } from '../utils'
|
||||
|
||||
export default useCustomer as UseCustomer<typeof handler>
|
||||
|
||||
@@ -13,7 +13,7 @@ export const handler: SWRHook<Customer | null> = {
|
||||
const data = await fetch<any | null>({
|
||||
...options,
|
||||
})
|
||||
return data.viewer ?? null
|
||||
return normalizeCustomer(data.viewer) ?? null
|
||||
},
|
||||
useHook: ({ useData }) => (input) => {
|
||||
return useData({
|
||||
|
Reference in New Issue
Block a user