Added checkFetchStatus function and fetch will use it.

This commit is contained in:
Christer
2020-04-05 02:29:39 +03:00
parent 368b8d2364
commit 3fee7bb40a
3 changed files with 21 additions and 7 deletions

View File

@ -0,0 +1,7 @@
module.exports = function (response) {
if (response.ok) { // res.status >= 200 && res.status < 300
return response;
} else {
throw new Error(response.status + " " + response.statusText);
}
}