mirror of
https://github.com/vercel/commerce.git
synced 2025-05-17 06:56: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
|
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
|
### Known Limitations
|
||||||
|
|
||||||
|
@ -13,9 +13,10 @@ export const handler: SWRHook<GetCartHook> = {
|
|||||||
method: 'GET',
|
method: 'GET',
|
||||||
},
|
},
|
||||||
fetcher: async ({ options, fetch }) => {
|
fetcher: async ({ options, fetch }) => {
|
||||||
if (getCartToken()) {
|
const cartToken = getCartToken()
|
||||||
|
if (cartToken) {
|
||||||
const syliusCart = await fetch({
|
const syliusCart = await fetch({
|
||||||
url: `${options.url}/${getCartToken()}`,
|
url: `${options.url}/${cartToken}`,
|
||||||
method: options.method,
|
method: options.method,
|
||||||
})
|
})
|
||||||
return normalizeCart(syliusCart)
|
return normalizeCart(syliusCart)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user