UI Provider

This commit is contained in:
Belen Curcio 2020-10-15 18:05:13 -03:00
parent 5e4d2c2f8f
commit d3d45e1b2a
2 changed files with 8 additions and 10 deletions

View File

@ -18,7 +18,7 @@ export default function useCart<T>(
fetcherFn: HookFetcher<T | null, CartInput>,
swrOptions?: ConfigInterface<T | null>
) {
const { cartCookie = '' } = useCommerce() | {}
const { cartCookie } = useCommerce()
const fetcher: typeof fetcherFn = (options, input, fetch) => {
input.cartId = Cookies.get(cartCookie)
return fetcherFn(options, input, fetch)

View File

@ -14,15 +14,13 @@ export default function MyApp({ Component, pageProps }: AppProps) {
const Layout = (Component as any).Layout || Noop
return (
<>
<CommerceProvider locale="en-us">
<Head />
<CommerceProvider locale="en-us">
<ManagedUIContext>
<Layout>
<Component {...pageProps} />
</Layout>
</ManagedUIContext>
</CommerceProvider>
</>
<ManagedUIContext>
<Layout>
<Component {...pageProps} />
</Layout>
</ManagedUIContext>
</CommerceProvider>
)
}