mirror of
https://github.com/vercel/commerce.git
synced 2025-05-16 14:36:59 +00:00
feat: call one time getCartToken
This commit is contained in:
parent
9bc876e02e
commit
4b357bdf2f
@ -36,7 +36,7 @@ NEXT_PUBLIC_SYLIUS_API_URL=127.0.1:8000
|
||||
NEXT_PUBLIC_SYLIUS_ALLOWED_IMAGE_DOMAIN=127.0.0.1
|
||||
```
|
||||
|
||||
4. With the Sylius server running, start this project using `yarn dev` or `npm run dev`.
|
||||
4. With the Sylius server running, start this project using `yarn dev`.
|
||||
|
||||
### Known Limitations
|
||||
|
||||
|
@ -13,9 +13,10 @@ export const handler: SWRHook<GetCartHook> = {
|
||||
method: 'GET',
|
||||
},
|
||||
fetcher: async ({ options, fetch }) => {
|
||||
if (getCartToken()) {
|
||||
const cartToken = getCartToken()
|
||||
if (cartToken) {
|
||||
const syliusCart = await fetch({
|
||||
url: `${options.url}/${getCartToken()}`,
|
||||
url: `${options.url}/${cartToken}`,
|
||||
method: options.method,
|
||||
})
|
||||
return normalizeCart(syliusCart)
|
||||
|
Loading…
x
Reference in New Issue
Block a user