This commit is contained in:
Luis Alvarez
2020-10-19 13:59:18 -05:00
10 changed files with 119 additions and 9 deletions

View File

@@ -19,10 +19,12 @@ export default function useCart<T>(
swrOptions?: ConfigInterface<T | null>
) {
const { cartCookie } = useCommerce()
const fetcher: typeof fetcherFn = (options, input, fetch) => {
input.cartId = Cookies.get(cartCookie)
return fetcherFn(options, input, fetch)
}
const response = useData(options, input, fetcher, swrOptions)
return Object.assign(response, { isEmpty: true }) as CartResponse<T>