This commit is contained in:
2019-03-07 18:30:53 +00:00
parent c3020ac34a
commit 399143cc70
5 changed files with 26 additions and 9 deletions

View File

@@ -36,7 +36,7 @@ export default {
// }
if (info) {
msg += "\ninfo: " + info;
}
}
dealWithError(msg);
},
handleVueWarning(wmsg, vm, trace) {
@@ -48,5 +48,13 @@ export default {
msg += "\ntrace: " + trace;
}
dealWithError(msg);
},
handleFormError(err) {
//called inside forms when things go wrong but are handled
if (err instanceof Error && err.message) {
dealWithError(err.message);
} else {
dealWithError(err.toString());
}
}
};

View File

@@ -12,7 +12,8 @@ export default {
return store.state.localeText[key];
},
fetch(keys) {
return new Promise(function(resolve, reject) {
return new Promise(function(resolve) {
//, reject
//step 1: build an array of keys that we don't have already
//Note: this will ensure only unique keys go into the store so it's safe to call this with dupes as can happen
var needIt = [];
@@ -21,11 +22,14 @@ export default {
needIt.push(keys[i]);
}
}
if (keys[0] == "Log") {
throw new Error("TEST ERROR IN LOCALE");
}
if (needIt.length == 0) {
resolve();
return;
}
//step 2: get it
fetch(apiUtil.APIUrl("locale/subset"), apiUtil.fetchPostOptions(needIt))
.then(apiUtil.status)
@@ -34,11 +38,12 @@ export default {
_.forEach(response.data, function(item) {
store.commit("addLocaleText", item);
});
resolve();
})
.catch(function(error) {
reject(error);
});
// .catch(function(error) {
// reject(error);
// });
});
},
//Keys that all edit forms have in common (saves retyping them over and over)