This commit is contained in:
@@ -4,7 +4,7 @@ import router from "../router";
|
||||
import auth from "./auth";
|
||||
import errorHandler from "./errorhandler";
|
||||
import gzevent from "./eventbus";
|
||||
import gzlocale from "./locale"
|
||||
import gzlocale from "./locale";
|
||||
|
||||
function stringifyPrimitive(v) {
|
||||
switch (typeof v) {
|
||||
@@ -31,7 +31,7 @@ function devShowUnknownError(error) {
|
||||
console.log("gzapi::devShowUnknownError, error is:");
|
||||
// eslint-disable-next-line
|
||||
console.log(error);
|
||||
// eslint-disable-next-line
|
||||
|
||||
gzevent.$emit(
|
||||
"popup-message",
|
||||
"DEV ERROR gzapi::devShowUnknownError - unexpected error during api operation see console "
|
||||
@@ -48,13 +48,21 @@ function handleError(action, error, route, reject) {
|
||||
"API error: " + action + " route =" + route + ", message =" + error.message;
|
||||
store.commit("logItem", errorMessage);
|
||||
|
||||
//TODO HANDLE 403 not authorized
|
||||
//popup then reject then go back in navigation or home, maybe home to be safe
|
||||
//gzlocale.get("Save")
|
||||
//Handle 403 not authorized
|
||||
//popup not authorized, log, then go to HOME
|
||||
//was going to go back one page, but realized most of the time a not authorized is in
|
||||
//reaction to directly entered or opened link, not application logic driving it, so home is safest choice
|
||||
//
|
||||
if (error.message && error.message.includes("NotAuthorized")) {
|
||||
store.commit("logItem", "User is not authorized!");
|
||||
gzevent.$emit("popup-message", gzlocale.get("ErrorUserNotAuthorized"));
|
||||
router.push("/");
|
||||
return reject("[ErrorUserNotAuthorized]");
|
||||
}
|
||||
|
||||
//Handle 401 not authenticated
|
||||
if (error.message && error.message.includes("NotAuthenticated")) {
|
||||
store.commit("logItem", "User is not authorized, redirecting to login");
|
||||
store.commit("logItem", "User is not authenticated, redirecting to login");
|
||||
auth.logout();
|
||||
router.push("/login");
|
||||
return reject("[ErrorUserNotAuthenticated]");
|
||||
|
||||
Reference in New Issue
Block a user