mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-07-29 07:01:35 +00:00
More rework
This commit is contained in:
@@ -11,6 +11,14 @@ Requests.JSONfetch = (input, init={}) => {
|
||||
fetch(input, Utils.mergeObjectsDeep(init, fixedInit))
|
||||
.then(
|
||||
(response) => {
|
||||
if (response.ok) {
|
||||
resolve(response.clone());
|
||||
} else {
|
||||
reject(response);
|
||||
}
|
||||
if (response.status === 204) {
|
||||
return;
|
||||
}
|
||||
response.json()
|
||||
.then(
|
||||
(json) => {
|
||||
@@ -22,11 +30,6 @@ Requests.JSONfetch = (input, init={}) => {
|
||||
app.flash(`[${response.status}]: ${response.statusText}`, 'error');
|
||||
}
|
||||
);
|
||||
if (response.ok) {
|
||||
resolve(response);
|
||||
} else {
|
||||
reject(response);
|
||||
}
|
||||
},
|
||||
(response) => {
|
||||
app.flash('Something went wrong', 'error');
|
||||
|
Reference in New Issue
Block a user