mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
Remove normalizers from the hooks
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { useMemo } from 'react'
|
||||
import { SWRHook } from '@commerce/utils/types'
|
||||
import useCart, { UseCart } from '@commerce/cart/use-cart'
|
||||
import { normalizeCart } from '../lib/normalize'
|
||||
import type { GetCartHook } from '../types/cart'
|
||||
|
||||
export default useCart as UseCart<typeof handler>
|
||||
@@ -11,10 +10,6 @@ export const handler: SWRHook<GetCartHook> = {
|
||||
url: '/api/bigcommerce/cart',
|
||||
method: 'GET',
|
||||
},
|
||||
async fetcher({ input: { cartId }, options, fetch }) {
|
||||
const data = cartId ? await fetch(options) : null
|
||||
return data && normalizeCart(data)
|
||||
},
|
||||
useHook: ({ useData }) => (input) => {
|
||||
const response = useData({
|
||||
swrOptions: { revalidateOnFocus: false, ...input?.swrOptions },
|
||||
|
Reference in New Issue
Block a user