mirror of
https://github.com/vercel/commerce.git
synced 2025-03-27 07:45:53 +00:00
* Add ordercloud provider * Fix provider errors * Make submit checkout optional * Make submit checkout optional * Remove nullables when creating endpoint type * Update readme * Log checkout error * Log error * Save token to cookie * Update fetch rest * Use token at checkout Co-authored-by: Luis Alvarez <luis@vercel.com>
44 lines
877 B
TypeScript
44 lines
877 B
TypeScript
import { HookFetcher } from '@commerce/utils/types'
|
|
import type { Product } from '@commerce/types/product'
|
|
|
|
const defaultOpts = {}
|
|
|
|
export type Wishlist = {
|
|
items: [
|
|
{
|
|
product_id: number
|
|
variant_id: number
|
|
id: number
|
|
product: Product
|
|
}
|
|
]
|
|
}
|
|
|
|
export interface UseWishlistOptions {
|
|
includeProducts?: boolean
|
|
}
|
|
|
|
export interface UseWishlistInput extends UseWishlistOptions {
|
|
customerId?: number
|
|
}
|
|
|
|
export const fetcher: HookFetcher<Wishlist | null, UseWishlistInput> = () => {
|
|
return null
|
|
}
|
|
|
|
export function extendHook(
|
|
customFetcher: typeof fetcher,
|
|
// swrOptions?: SwrOptions<Wishlist | null, UseWishlistInput>
|
|
swrOptions?: any
|
|
) {
|
|
const useWishlist = ({ includeProducts }: UseWishlistOptions = {}) => {
|
|
return { data: null }
|
|
}
|
|
|
|
useWishlist.extend = extendHook
|
|
|
|
return useWishlist
|
|
}
|
|
|
|
export default extendHook(fetcher)
|