mirror of
https://github.com/vercel/commerce.git
synced 2025-03-14 22:42:33 +00:00
Moved the fetcher to its own file
This commit is contained in:
parent
c4870a05e8
commit
75d485d35a
@ -1,10 +1,5 @@
|
||||
import { FetcherError } from '@commerce/utils/errors'
|
||||
import type { Fetcher } from '@commerce/utils/types'
|
||||
import { normalizeCart } from './lib/normalize'
|
||||
import { handler as useCart } from './cart/use-cart'
|
||||
import { handler as useWishlist } from './wishlist/use-wishlist'
|
||||
import { handler as useCustomer } from './customer/use-customer'
|
||||
import { handler as useSearch } from './product/use-search'
|
||||
|
||||
async function getText(res: Response) {
|
||||
try {
|
||||
@ -43,15 +38,4 @@ const fetcher: Fetcher = async ({
|
||||
throw await getError(res)
|
||||
}
|
||||
|
||||
export const bigcommerceProvider = {
|
||||
locale: 'en-us',
|
||||
cartCookie: 'bc_cartId',
|
||||
fetcher,
|
||||
cartNormalizer: normalizeCart,
|
||||
cart: { useCart },
|
||||
wishlist: { useWishlist },
|
||||
customer: { useCustomer },
|
||||
products: { useSearch },
|
||||
}
|
||||
|
||||
export type BigcommerceProvider = typeof bigcommerceProvider
|
||||
export default fetcher
|
17
framework/bigcommerce/provider.ts
Normal file
17
framework/bigcommerce/provider.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { handler as useCart } from './cart/use-cart'
|
||||
import { handler as useWishlist } from './wishlist/use-wishlist'
|
||||
import { handler as useCustomer } from './customer/use-customer'
|
||||
import { handler as useSearch } from './product/use-search'
|
||||
import fetcher from './fetcher'
|
||||
|
||||
export const bigcommerceProvider = {
|
||||
locale: 'en-us',
|
||||
cartCookie: 'bc_cartId',
|
||||
fetcher,
|
||||
cart: { useCart },
|
||||
wishlist: { useWishlist },
|
||||
customer: { useCustomer },
|
||||
products: { useSearch },
|
||||
}
|
||||
|
||||
export type BigcommerceProvider = typeof bigcommerceProvider
|
Loading…
x
Reference in New Issue
Block a user