This commit is contained in:
@@ -57,7 +57,11 @@ function handleError(action, error, route, reject) {
|
||||
window.$gz.translation.get("ErrorUserNotAuthorized")
|
||||
);
|
||||
router.push(window.$gz.store.state.homePage);
|
||||
return reject("[ErrorUserNotAuthorized]");
|
||||
if (reject) {
|
||||
return reject("[ErrorUserNotAuthorized]");
|
||||
} else {
|
||||
throw "[ErrorUserNotAuthorized]";
|
||||
}
|
||||
}
|
||||
|
||||
//Handle 401 not authenticated
|
||||
@@ -72,7 +76,11 @@ function handleError(action, error, route, reject) {
|
||||
);
|
||||
auth.logout();
|
||||
router.push("/login");
|
||||
return reject("[ErrorUserNotAuthenticated]");
|
||||
if (reject) {
|
||||
return reject("[ErrorUserNotAuthenticated]");
|
||||
} else {
|
||||
throw "[ErrorUserNotAuthenticated]";
|
||||
}
|
||||
}
|
||||
|
||||
//is it a network error?
|
||||
@@ -96,7 +104,12 @@ function handleError(action, error, route, reject) {
|
||||
|
||||
window.$gz.eventBus.$emit("notify-error", msg);
|
||||
//note: using translation key in square brackets
|
||||
return reject(msg);
|
||||
|
||||
if (reject) {
|
||||
return reject(msg);
|
||||
} else {
|
||||
throw msg;
|
||||
}
|
||||
//throw "Error: unable to contact server";
|
||||
}
|
||||
}
|
||||
@@ -460,7 +473,7 @@ export default {
|
||||
r = await that.extractBodyEx(r);
|
||||
return r;
|
||||
} catch (error) {
|
||||
handleError("UPSERT", error, route, reject);
|
||||
handleError("UPSERT", error, route);
|
||||
}
|
||||
},
|
||||
upsert(route, data) {
|
||||
|
||||
Reference in New Issue
Block a user