forked from crowetic/commerce
UI Provider
This commit is contained in:
parent
5e4d2c2f8f
commit
d3d45e1b2a
@ -18,7 +18,7 @@ export default function useCart<T>(
|
|||||||
fetcherFn: HookFetcher<T | null, CartInput>,
|
fetcherFn: HookFetcher<T | null, CartInput>,
|
||||||
swrOptions?: ConfigInterface<T | null>
|
swrOptions?: ConfigInterface<T | null>
|
||||||
) {
|
) {
|
||||||
const { cartCookie = '' } = useCommerce() | {}
|
const { cartCookie } = useCommerce()
|
||||||
const fetcher: typeof fetcherFn = (options, input, fetch) => {
|
const fetcher: typeof fetcherFn = (options, input, fetch) => {
|
||||||
input.cartId = Cookies.get(cartCookie)
|
input.cartId = Cookies.get(cartCookie)
|
||||||
return fetcherFn(options, input, fetch)
|
return fetcherFn(options, input, fetch)
|
||||||
|
@ -14,15 +14,13 @@ export default function MyApp({ Component, pageProps }: AppProps) {
|
|||||||
const Layout = (Component as any).Layout || Noop
|
const Layout = (Component as any).Layout || Noop
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<CommerceProvider locale="en-us">
|
||||||
<Head />
|
<Head />
|
||||||
<CommerceProvider locale="en-us">
|
<ManagedUIContext>
|
||||||
<ManagedUIContext>
|
<Layout>
|
||||||
<Layout>
|
<Component {...pageProps} />
|
||||||
<Component {...pageProps} />
|
</Layout>
|
||||||
</Layout>
|
</ManagedUIContext>
|
||||||
</ManagedUIContext>
|
</CommerceProvider>
|
||||||
</CommerceProvider>
|
|
||||||
</>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user