This commit is contained in:
2020-06-19 21:38:32 +00:00
parent 48d062c49b
commit bfcae2a750
15 changed files with 76 additions and 58 deletions

View File

@@ -42,8 +42,8 @@ export default {
if (!window.$gz._.has(window.$gz.store.state.enums, k)) {
let that = this;
await that.fetchEnumKey(k).then(dat => {
// eslint-disable-next-line
await that.fetchEnumKey(k).then((dat) => {
//massage the data as necessary
let e = { enumKey: k, items: {} };
for (let i = 0; i < dat.length; i++) {
@@ -57,9 +57,11 @@ export default {
}
},
fetchEnumKey(enumKey) {
return window.$gz.api.get("enum-list/list/" + enumKey).then(res => {
if (res.error) {
throw res.error;
// eslint-disable-next-line
return window.$gz.api.get("enum-list/list/" + enumKey).then((res) => {
//We never expect there to be no data here
if (!res.data) {
throw res;
}
return res.data;
});

View File

@@ -130,6 +130,15 @@ export default {
msg += "\n";
}
dealWithError(msg, vm);
} else if (err instanceof Response) {
let msg =
"http error: " +
err.statusText +
" - " +
err.status +
" Url: " +
err.url;
dealWithError(msg, vm);
} else {
//last resort
let msg = JSON.stringify(err);