mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
setup custom fetcher and auth hooks
This commit is contained in:
@@ -11,15 +11,16 @@ export async function getAsyncError(res: Response) {
|
||||
}
|
||||
|
||||
const handleFetchResponse = async (res: Response) => {
|
||||
if (res.ok) {
|
||||
const { data, errors } = await res.json()
|
||||
// if (res.ok) {
|
||||
// const { data, errors } = await res.json()
|
||||
|
||||
if (errors && errors.length) {
|
||||
throw getError(errors, res.status)
|
||||
}
|
||||
// if (errors && errors.length) {
|
||||
// throw getError(errors, res.status)
|
||||
// }
|
||||
|
||||
return data
|
||||
}
|
||||
// return data
|
||||
// }
|
||||
if (res) return res
|
||||
|
||||
throw await getAsyncError(res)
|
||||
}
|
||||
|
Reference in New Issue
Block a user