4
0
forked from crowetic/commerce
Peter Mekhaeil 300d04c1ac
Shopify Provider ()
* Start of Shopify provider

* add missing comment to documentation

* add missing env vars to documentation

* update reference to types file
2021-02-12 11:14:16 -03:00

33 lines
721 B
TypeScript

import type { HookFetcher } from '@commerce/utils/types'
import type { SwrOptions } from '@commerce/utils/use-data'
import useCommerceCustomer from '@commerce/use-customer'
const defaultOpts = {}
export type Customer = {
entityId: number
firstName: string
lastName: string
email: string
}
export type CustomerData = {}
export const fetcher: HookFetcher<Customer | null> = async () => {
return null
}
export function extendHook(
customFetcher: typeof fetcher,
swrOptions?: SwrOptions<Customer | null>
) {
const useCustomer = () => {
return { data: { firstName: null, lastName: null, email: null } }
}
useCustomer.extend = extendHook
return useCustomer
}
export default extendHook(fetcher)