forked from crowetic/commerce
Updated config in operations
This commit is contained in:
parent
385fd10fce
commit
b1e6aa25b5
@ -25,7 +25,7 @@ const cartApi: BigcommerceApiHandler = async (req, res, config) => {
|
||||
)
|
||||
} catch (error) {
|
||||
if (error instanceof BigcommerceApiError && error.status === 404) {
|
||||
// The cookie exists but the cart wasn't found, so, remove the cookie
|
||||
// Remove the cookie if it exists but the cart wasn't found
|
||||
res.setHeader('Set-Cookie', getCartCookie(name))
|
||||
} else {
|
||||
throw error
|
||||
|
@ -33,11 +33,12 @@ async function getAllProductPaths<T, V = any>(opts: {
|
||||
|
||||
async function getAllProductPaths({
|
||||
query = getAllProductPathsQuery,
|
||||
config = getConfig(),
|
||||
config,
|
||||
}: {
|
||||
query?: string
|
||||
config?: BigcommerceConfig
|
||||
} = {}): Promise<GetAllProductPathsResult<GetAllProductPathsQuery>> {
|
||||
config = getConfig(config)
|
||||
// RecursivePartial forces the method to check for every prop in the data, which is
|
||||
// required in case there's a custom `query`
|
||||
const data = await config.fetch<RecursivePartial<GetAllProductPathsQuery>>(
|
||||
|
@ -60,12 +60,13 @@ async function getAllProducts<T, V = any>(opts: {
|
||||
async function getAllProducts({
|
||||
query = getAllProductsQuery,
|
||||
variables: vars,
|
||||
config = getConfig(),
|
||||
config,
|
||||
}: {
|
||||
query?: string
|
||||
variables?: ProductVariables
|
||||
config?: BigcommerceConfig
|
||||
} = {}): Promise<GetAllProductsResult<GetAllProductsQuery>> {
|
||||
config = getConfig(config)
|
||||
const variables: GetAllProductsQueryVariables = {
|
||||
...config.imageVariables,
|
||||
...vars,
|
||||
|
@ -56,12 +56,13 @@ async function getProduct<T, V = any>(opts: {
|
||||
async function getProduct({
|
||||
query = getProductQuery,
|
||||
variables: { slug, ...vars },
|
||||
config = getConfig(),
|
||||
config,
|
||||
}: {
|
||||
query?: string
|
||||
variables: ProductVariables
|
||||
config?: BigcommerceConfig
|
||||
}): Promise<GetProductResult<GetProductQuery>> {
|
||||
config = getConfig(config)
|
||||
const variables: GetProductQueryVariables = {
|
||||
...config.imageVariables,
|
||||
...vars,
|
||||
|
Loading…
x
Reference in New Issue
Block a user