This commit is contained in:
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -174,19 +174,12 @@ export default {
|
||||
return {
|
||||
obj: {},
|
||||
serverError: {},
|
||||
formReady: false,
|
||||
someerror:
|
||||
"blah blahv <br/> blah blah" + "\n test line 3" + "\r\n Test line 4"
|
||||
formReady: false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
Change(ref) {
|
||||
//debugger;
|
||||
//console.log("CHANGE - " + ref);
|
||||
this.$gzv.Change(this, ref);
|
||||
//Make form re-validate here and if it works then make it do it only if gzv.change returns true or something indicating it's required to re-validate or clear that input's errors
|
||||
// this.$refs.form.resetValidation();
|
||||
// this.$refs.form.validate();
|
||||
Change(ref) {
|
||||
this.$gzv.Change(this, ref);
|
||||
},
|
||||
getDataFromApi() {
|
||||
var url = "Widget/" + this.$route.params.id;
|
||||
@@ -224,27 +217,11 @@ export default {
|
||||
that.obj.concurrencyToken = res.data.concurrencyToken;
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(function(error) {
|
||||
//we should be here if it was a gross error of some kind not a mild one like validation but more like if the server doesn't exist or something I guess
|
||||
|
||||
console.log(error);
|
||||
alert("Houston, we have a problem");
|
||||
});
|
||||
//In theory all exceptions should be handled by the gzapi methods, so we should not need to deal with this in the form very often if at all
|
||||
// .catch(function(error) {
|
||||
// });
|
||||
|
||||
//example from login form
|
||||
// if (this.input.username != "" && this.input.password != "") {
|
||||
// auth
|
||||
// .authenticate(this.input.username, this.input.password)
|
||||
// .then(() => {
|
||||
// this.$router.replace({ name: "home" });
|
||||
// })
|
||||
// .catch(function(error) {
|
||||
// /* xeslint-disable-next-line */
|
||||
// //console.log(error);
|
||||
// alert("login failed: " + error);
|
||||
// });
|
||||
// }
|
||||
} //end of submit()
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user