Updated types for hooks now using the API

This commit is contained in:
Luis Alvarez
2021-03-29 11:25:21 -06:00
parent d3fe16e1d7
commit 8ad6a34175
5 changed files with 67 additions and 69 deletions

View File

@@ -1,17 +1,12 @@
import { useMemo } from 'react'
import { SWRHook } from '@commerce/utils/types'
import useCart, { UseCart, FetchCartInput } from '@commerce/cart/use-cart'
import useCart, { UseCart } from '@commerce/cart/use-cart'
import { normalizeCart } from '../lib/normalize'
import type { Cart } from '../types'
import type { GetCartHook } from '../types/cart'
export default useCart as UseCart<typeof handler>
export const handler: SWRHook<
Cart | null,
{},
FetchCartInput,
{ isEmpty?: boolean }
> = {
export const handler: SWRHook<GetCartHook> = {
fetchOptions: {
url: '/api/bigcommerce/cart',
method: 'GET',