This commit is contained in:
2020-04-04 19:03:19 +00:00
parent 67071b817a
commit 823b1aa7e5
3 changed files with 16 additions and 8 deletions

View File

@@ -39,7 +39,7 @@ function dealWithError(msg, vm) {
//If a form instance was provided (vue instance) //If a form instance was provided (vue instance)
//then put the error into it //then put the error into it
if (vm) { if (vm) {
if (window.$gz.errorHandler.devMode()) { if (vm.ay.dev()) {
//make sure formState.appError is defined on data //make sure formState.appError is defined on data
if (!window.$gz._.has(vm, "formState.appError")) { if (!window.$gz._.has(vm, "formState.appError")) {
throw "DEV ERROR errorHandler::dealWithError -> formState.appError seems to be missing from form's vue data object"; throw "DEV ERROR errorHandler::dealWithError -> formState.appError seems to be missing from form's vue data object";

View File

@@ -22,7 +22,7 @@ function stringifyPrimitive(v) {
// Show unexpected errors during development // Show unexpected errors during development
// //
function devShowUnknownError(error) { function devShowUnknownError(error) {
if (window.$gz.errorHandler.devMode) { if (window.$gz.dev) {
// eslint-disable-next-line // eslint-disable-next-line
console.error("gzapi::devShowUnknownError, error is:", error); console.error("gzapi::devShowUnknownError, error is:", error);
@@ -300,7 +300,8 @@ export default {
fetch(that.APIUrl(route), that.fetchGetOptions()) fetch(that.APIUrl(route), that.fetchGetOptions())
.then(that.status) .then(that.status)
.then(that.json) .then(that.json)
.then(response => { // eslint-disable-next-line
.then((response) => {
resolve(response); resolve(response);
}) })
.catch(function handleGetError(error) { .catch(function handleGetError(error) {
@@ -331,7 +332,8 @@ export default {
fetch(that.APIUrl(route), fetchOptions) fetch(that.APIUrl(route), fetchOptions)
.then(that.status) .then(that.status)
.then(that.json) .then(that.json)
.then(response => { // eslint-disable-next-line
.then((response) => {
//Note: response.error indicates there is an error, however this is not an unusual condition //Note: response.error indicates there is an error, however this is not an unusual condition
//it could be validation errors or other general error so we need to treat it here like it's normal //it could be validation errors or other general error so we need to treat it here like it's normal
//and let the caller deal with it appropriately //and let the caller deal with it appropriately
@@ -351,7 +353,8 @@ export default {
fetch(that.APIUrl(route), that.fetchRemoveOptions()) fetch(that.APIUrl(route), that.fetchRemoveOptions())
.then(that.status) .then(that.status)
//.then(that.json) //.then(that.json)
.then(response => { // eslint-disable-next-line
.then((response) => {
resolve(response); resolve(response);
}) })
.catch(function handleRemoveError(error) { .catch(function handleRemoveError(error) {
@@ -369,7 +372,8 @@ export default {
fetch(that.APIUrl(route), that.fetchPostOptions(null)) fetch(that.APIUrl(route), that.fetchPostOptions(null))
.then(that.status) .then(that.status)
.then(that.json) .then(that.json)
.then(response => { // eslint-disable-next-line
.then((response) => {
//Note: response.error indicates there is an error, however this is not an unusual condition //Note: response.error indicates there is an error, however this is not an unusual condition
//it could be validation errors or other general error so we need to treat it here like it's normal //it could be validation errors or other general error so we need to treat it here like it's normal
//and let the caller deal with it appropriately //and let the caller deal with it appropriately

View File

@@ -1,4 +1,7 @@
/* Xeslint-disable */ /* Xeslint-disable */
//************************************************************
const DEV_MODE = true;
//************************************************************
import "@fortawesome/fontawesome-free/css/all.css"; import "@fortawesome/fontawesome-free/css/all.css";
import "typeface-roboto/index.css"; import "typeface-roboto/index.css";
import Vue from "vue"; import Vue from "vue";
@@ -70,7 +73,8 @@ window.$gz = {
report: gzreport, report: gzreport,
errorHandler: errorhandler, errorHandler: errorhandler,
store: store, store: store,
clientInfo: ayaNovaVersion clientInfo: ayaNovaVersion,
dev: DEV_MODE
}; };
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
@@ -184,7 +188,7 @@ Vue.directive("focus", {
// //
Vue.prototype.$ay = { Vue.prototype.$ay = {
//development mode, this enables data-cy tags for testing, development level error messages etc //development mode, this enables data-cy tags for testing, development level error messages etc
dev: true, dev: DEV_MODE,
t: function(tKey) { t: function(tKey) {
return translation.get(tKey); return translation.get(tKey);
} }