This commit is contained in:
2019-04-04 17:20:42 +00:00
parent 8f6887d5f3
commit 67d46052c7
3 changed files with 26 additions and 48 deletions

View File

@@ -2,6 +2,7 @@
import store from "../store";
import router from "../router";
import auth from "./auth";
import errorHandler from "./errorhandler";
var stringifyPrimitive = function(v) {
switch (typeof v) {
@@ -19,6 +20,19 @@ var stringifyPrimitive = function(v) {
}
};
var devShowUnknownError = function(error) {
if (errorHandler.devMode) {
// eslint-disable-next-line
console.log("apiutil::devShowUnknownError, error is:");
// eslint-disable-next-line
console.log(error);
// eslint-disable-next-line
alert(
"DEV ERROR apiutil::devShowUnknownError - unexpected error during api operation see console "
);
}
};
export default {
status(response) {
if (response.status == 401) {
@@ -204,7 +218,8 @@ export default {
auth.logout();
router.push("/login");
} else {
alert("Error: " + errorMessage);
//This should never get called because any issue should be addressed above in a proper error handler
devShowUnknownError(error);
reject(error);
}
});
@@ -247,7 +262,8 @@ export default {
auth.logout();
router.push("/login");
} else {
//alert("Error: " + errorMessage);
//This should never get called because any issue should be addressed above in a proper error handler
devShowUnknownError(error);
reject(error);
}
});