setup custom fetcher and auth hooks

This commit is contained in:
Greg Hoskin
2021-03-27 15:54:32 -06:00
parent 753234dc51
commit ee1d8ed461
37 changed files with 299 additions and 103 deletions

View File

@@ -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)
}