mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
rename folder
This commit is contained in:
30
providers/saleor/customer/use-customer.tsx
Normal file
30
providers/saleor/customer/use-customer.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
import useCustomer, { UseCustomer } from '@commerce/customer/use-customer'
|
||||
import { CustomerHook } from '@commerce/types/customer'
|
||||
import { SWRHook } from '@commerce/utils/types'
|
||||
|
||||
import * as query from '../utils/queries'
|
||||
|
||||
export default useCustomer as UseCustomer<typeof handler>
|
||||
|
||||
export const handler: SWRHook<CustomerHook> = {
|
||||
fetchOptions: {
|
||||
query: query.CustomerCurrent,
|
||||
},
|
||||
async fetcher({ options, fetch }) {
|
||||
const data = await fetch<any | null>({
|
||||
...options,
|
||||
variables: {},
|
||||
})
|
||||
return data.me ?? null
|
||||
},
|
||||
useHook:
|
||||
({ useData }) =>
|
||||
(input) => {
|
||||
return useData({
|
||||
swrOptions: {
|
||||
revalidateOnFocus: false,
|
||||
...input?.swrOptions,
|
||||
},
|
||||
})
|
||||
},
|
||||
}
|
Reference in New Issue
Block a user