mirror of
https://github.com/vercel/commerce.git
synced 2025-06-19 13:41:22 +00:00
Fixes
This commit is contained in:
parent
656a5db58d
commit
cf9b341dc9
@ -3,13 +3,13 @@ import type { GraphQLFetcher } from '@commerce/api'
|
|||||||
import { provider } from '..'
|
import { provider } from '..'
|
||||||
import fetch from './fetch'
|
import fetch from './fetch'
|
||||||
|
|
||||||
const { config } = provider
|
|
||||||
const fetchGraphqlApi: GraphQLFetcher = async (
|
const fetchGraphqlApi: GraphQLFetcher = async (
|
||||||
query: string,
|
query: string,
|
||||||
{ variables, preview } = {},
|
{ variables, preview } = {},
|
||||||
fetchOptions
|
fetchOptions
|
||||||
) => {
|
) => {
|
||||||
// log.warn(query)
|
// log.warn(query)
|
||||||
|
const { config } = provider
|
||||||
const res = await fetch(config.commerceUrl + (preview ? '/preview' : ''), {
|
const res = await fetch(config.commerceUrl + (preview ? '/preview' : ''), {
|
||||||
...fetchOptions,
|
...fetchOptions,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -3,12 +3,11 @@ import { provider } from '..'
|
|||||||
import { BigcommerceApiError, BigcommerceNetworkError } from './errors'
|
import { BigcommerceApiError, BigcommerceNetworkError } from './errors'
|
||||||
import fetch from './fetch'
|
import fetch from './fetch'
|
||||||
|
|
||||||
const { config } = provider
|
|
||||||
|
|
||||||
export default async function fetchStoreApi<T>(
|
export default async function fetchStoreApi<T>(
|
||||||
endpoint: string,
|
endpoint: string,
|
||||||
options?: RequestInit
|
options?: RequestInit
|
||||||
): Promise<T> {
|
): Promise<T> {
|
||||||
|
const { config } = provider
|
||||||
let res: Response
|
let res: Response
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -14,7 +14,16 @@ const noop = () => {
|
|||||||
throw new Error('Not implemented')
|
throw new Error('Not implemented')
|
||||||
}
|
}
|
||||||
|
|
||||||
export const OPERATIONS = ['login'] as const
|
export const OPERATIONS = [
|
||||||
|
'login',
|
||||||
|
'getAllPages',
|
||||||
|
'getPage',
|
||||||
|
'getSiteInfo',
|
||||||
|
'getCustomerWishlist',
|
||||||
|
'getAllProductPaths',
|
||||||
|
'getAllProducts',
|
||||||
|
'getProduct',
|
||||||
|
] as const
|
||||||
|
|
||||||
export const defaultOperations = OPERATIONS.reduce((ops, k) => {
|
export const defaultOperations = OPERATIONS.reduce((ops, k) => {
|
||||||
ops[k] = noop
|
ops[k] = noop
|
||||||
|
Loading…
x
Reference in New Issue
Block a user