Removed duplicated fetcher

This commit is contained in:
Luis Alvarez
2021-02-08 19:50:45 -05:00
parent 7f3174bcd0
commit 2a5cbadd3a
2 changed files with 4 additions and 17 deletions

View File

@@ -90,21 +90,6 @@ export type BigcommerceProvider = typeof bigcommerceProvider
export const bigcommerceConfig: CommerceConfig = {
locale: 'en-us',
cartCookie: 'bc_cartId',
async fetcher({ url, method = 'GET', variables, body: bodyObj }) {
const hasBody = Boolean(variables || bodyObj)
const body = hasBody
? JSON.stringify(variables ? { variables } : bodyObj)
: undefined
const headers = hasBody ? { 'Content-Type': 'application/json' } : undefined
const res = await fetch(url!, { method, body, headers })
if (res.ok) {
const { data } = await res.json()
return data
}
throw await getError(res)
},
}
export type BigcommerceConfig = Partial<CommerceConfig>