mirror of
https://github.com/vercel/commerce.git
synced 2025-06-09 17:46:57 +00:00
feat: add type in hook
This commit is contained in:
parent
af565bb2a4
commit
7ab1d9a50d
@ -3,10 +3,11 @@ import { SWRHook } from '@vercel/commerce/utils/types'
|
|||||||
import useCart, { UseCart } from '@vercel/commerce/cart/use-cart'
|
import useCart, { UseCart } from '@vercel/commerce/cart/use-cart'
|
||||||
import { getCartToken } from '../utils/token/cart-token'
|
import { getCartToken } from '../utils/token/cart-token'
|
||||||
import { normalizeCart } from '../utils/normalize/normalize-cart'
|
import { normalizeCart } from '../utils/normalize/normalize-cart'
|
||||||
|
import { GetCartHook } from '@vercel/commerce/types/cart'
|
||||||
|
|
||||||
export default useCart as UseCart<typeof handler>
|
export default useCart as UseCart<typeof handler>
|
||||||
|
|
||||||
export const handler: SWRHook<any> = {
|
export const handler: SWRHook<GetCartHook> = {
|
||||||
fetchOptions: {
|
fetchOptions: {
|
||||||
url: `/api/v2/shop/orders`,
|
url: `/api/v2/shop/orders`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
@ -116,7 +116,7 @@ export const normalizeProductImage = (
|
|||||||
image: SyliusProductImage
|
image: SyliusProductImage
|
||||||
): ProductImage => {
|
): ProductImage => {
|
||||||
return {
|
return {
|
||||||
url: process.env.NEXT_PUBLIC_SYLIUS_ALLOWED_IMAGE_URL + image.path,
|
url: process.env.NEXT_PUBLIC_SYLIUS_API_URL + image.path,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user