This commit is contained in:
@@ -96,6 +96,7 @@ All platforms and browsers
|
|||||||
End to end action
|
End to end action
|
||||||
- Code for new record to the server
|
- 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: 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: 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: 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?
|
TODO: History button, other AyaNova 7 example buttons all need to be there or their equivalent, do we need a top menu type thing?
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import store from "../store";
|
|||||||
import router from "../router";
|
import router from "../router";
|
||||||
import auth from "./auth";
|
import auth from "./auth";
|
||||||
import errorHandler from "./errorhandler";
|
import errorHandler from "./errorhandler";
|
||||||
|
import gzevent from "./eventbus";
|
||||||
|
import gzlocale from "./locale"
|
||||||
|
|
||||||
function stringifyPrimitive(v) {
|
function stringifyPrimitive(v) {
|
||||||
switch (typeof v) {
|
switch (typeof v) {
|
||||||
@@ -30,7 +32,8 @@ function devShowUnknownError(error) {
|
|||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
console.log(error);
|
console.log(error);
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
alert(
|
gzevent.$emit(
|
||||||
|
"popup-message",
|
||||||
"DEV ERROR gzapi::devShowUnknownError - unexpected error during api operation see console "
|
"DEV ERROR gzapi::devShowUnknownError - unexpected error during api operation see console "
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -45,14 +48,18 @@ function handleError(action, error, route, reject) {
|
|||||||
"API error: " + action + " route =" + route + ", message =" + error.message;
|
"API error: " + action + " route =" + route + ", message =" + error.message;
|
||||||
store.commit("logItem", errorMessage);
|
store.commit("logItem", errorMessage);
|
||||||
|
|
||||||
//BUGBUG?? What if the 401 is just a rights issue and not because they have no authentication at all??
|
//TODO HANDLE 403 not authorized
|
||||||
//perhaps that would never happen
|
//popup then reject then go back in navigation or home, maybe home to be safe
|
||||||
|
//gzlocale.get("Save")
|
||||||
|
|
||||||
|
//Handle 401 not authenticated
|
||||||
if (error.message && error.message.includes("NotAuthenticated")) {
|
if (error.message && error.message.includes("NotAuthenticated")) {
|
||||||
store.commit("logItem", "User is not authorized, redirecting to login");
|
store.commit("logItem", "User is not authorized, redirecting to login");
|
||||||
auth.logout();
|
auth.logout();
|
||||||
router.push("/login");
|
router.push("/login");
|
||||||
return reject("[ErrorUserNotAuthenticated]");
|
return reject("[ErrorUserNotAuthenticated]");
|
||||||
}
|
}
|
||||||
|
|
||||||
//is it a network error?
|
//is it a network error?
|
||||||
//https://medium.com/@vinhlh/how-to-handle-networkerror-when-using-fetch-ff2663220435
|
//https://medium.com/@vinhlh/how-to-handle-networkerror-when-using-fetch-ff2663220435
|
||||||
if (error instanceof TypeError) {
|
if (error instanceof TypeError) {
|
||||||
@@ -84,7 +91,6 @@ export default {
|
|||||||
return Promise.reject(new Error("[ErrorUserNotAuthorized]"));
|
return Promise.reject(new Error("[ErrorUserNotAuthorized]"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (response.status >= 200 && response.status < 300) {
|
if (response.status >= 200 && response.status < 300) {
|
||||||
return Promise.resolve(response);
|
return Promise.resolve(response);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -184,6 +184,10 @@ export default {
|
|||||||
vm.$gzevent.$on("menu-click", function handleMenuClick(menuitem) {
|
vm.$gzevent.$on("menu-click", function handleMenuClick(menuitem) {
|
||||||
self.handleAppClick(vm, menuitem);
|
self.handleAppClick(vm, menuitem);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
vm.$gzevent.$on("popup-message", function handlePopupMessage(msg) {
|
||||||
|
alert(msg);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
//new functions above here
|
//new functions above here
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -397,12 +397,16 @@ export default {
|
|||||||
alert("STUB: DELETE");
|
alert("STUB: DELETE");
|
||||||
},
|
},
|
||||||
duplicate() {
|
duplicate() {
|
||||||
this.$gzrole.getRights(this, this.$gztype.Widget, this.obj.ownerId);
|
//this.$gzrole.getRights(this, this.$gztype.Widget, this.obj.ownerId);
|
||||||
|
this.$gzevent.$emit(
|
||||||
|
"popup-message",
|
||||||
|
"This is a test popup message\r\nDUPLICATE ALL THE THINGS!"
|
||||||
|
);
|
||||||
//only if not dirty
|
//only if not dirty
|
||||||
//check rights
|
//check rights
|
||||||
//duplicate
|
//duplicate
|
||||||
//navigate to new record
|
//navigate to new record
|
||||||
alert("STUB: DUPLICATE");
|
//alert("STUB: DUPLICATE");
|
||||||
},
|
},
|
||||||
stubTestClick() {
|
stubTestClick() {
|
||||||
this.$gzevent.$emit("menu-replace-item", {
|
this.$gzevent.$emit("menu-replace-item", {
|
||||||
|
|||||||
Reference in New Issue
Block a user