If the response is not "ok", reject fetch
This commit is contained in:
parent
daaa587aa2
commit
532f54db54
@ -15,7 +15,8 @@ export default function fetch(path, data = {}) {
|
||||
.field(data)
|
||||
.attach(files)
|
||||
.end(response => {
|
||||
if (response.statusType === 4 || response.statusType === 5) {
|
||||
if (response.statusType === 4 || response.statusType === 5 ||
|
||||
!response.body.ok) {
|
||||
reject(response);
|
||||
} else {
|
||||
resolve(response.body);
|
||||
|
Loading…
Reference in New Issue
Block a user