Login should work now!

This commit is contained in:
Luis Alvarez
2020-10-22 17:13:28 -05:00
parent 3941b90b0f
commit 7c91f8a80f
3 changed files with 51 additions and 3 deletions

View File

@@ -1,3 +1,4 @@
import { FetcherError } from '@lib/commerce/utils/errors'
import type { GraphQLFetcher } from 'lib/commerce/api'
import { getConfig } from '..'
import log from '@lib/logger'
@@ -25,8 +26,10 @@ const fetchGraphqlApi: GraphQLFetcher = async (
const json = await res.json()
if (json.errors) {
console.error(json.errors)
throw new Error('Failed to fetch BigCommerce API')
throw new FetcherError({
errors: json.errors ?? [{ message: 'Failed to fetch Bigcommerce API' }],
status: res.status,
})
}
return { data: json.data, res }