This commit is contained in:
@@ -96,7 +96,8 @@ All platforms and browsers
|
||||
End to end action
|
||||
- Code for new record to the server
|
||||
|
||||
TODO: can I send a message via event bus which shows a popup notification? So I'm not tempted to use alert boxes all over the place [ErrorNotAuthorized] etc
|
||||
TODO: No 404? Can enter a route of /bad and it will just show an empty form like it thinks it's valid or something
|
||||
TODO: Add toast popup or however it's supposed to happen to the gzmenu handler where popups are processed
|
||||
TODO: INVESTIGATE - DO I need to institute a back button? (in APP MODE?? installed to "desktop" on device will I be able to easily navigate without back and forward buttons)
|
||||
TODO: Delete widget button and rights stuff
|
||||
TODO: History button, other AyaNova 7 example buttons all need to be there or their equivalent, do we need a top menu type thing?
|
||||
|
||||
@@ -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