This commit is contained in:
@@ -34,7 +34,6 @@ export default {
|
||||
if (!window.$gz._.isArray(enumKey)) {
|
||||
enumKey = [enumKey];
|
||||
}
|
||||
|
||||
for (let i = 0; i < enumKey.length; i++) {
|
||||
//check if list
|
||||
//if not then fetch it and store it
|
||||
@@ -43,27 +42,25 @@ export default {
|
||||
if (!window.$gz._.has(window.$gz.store.state.enums, k)) {
|
||||
let that = this;
|
||||
// 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++) {
|
||||
let o = dat[i];
|
||||
e.items[o.id] = o.name;
|
||||
}
|
||||
//stuff the data into the store
|
||||
window.$gz.store.commit("setEnum", e);
|
||||
});
|
||||
let dat = await that.fetchEnumKey(k);
|
||||
//massage the data as necessary
|
||||
let e = { enumKey: k, items: {} };
|
||||
for (let i = 0; i < dat.length; i++) {
|
||||
let o = dat[i];
|
||||
e.items[o.id] = o.name;
|
||||
}
|
||||
//stuff the data into the store
|
||||
window.$gz.store.commit("setEnum", e);
|
||||
}
|
||||
}
|
||||
},
|
||||
fetchEnumKey(enumKey) {
|
||||
async fetchEnumKey(enumKey) {
|
||||
// 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;
|
||||
});
|
||||
let res = await window.$gz.api.get("enum-list/list/" + enumKey);
|
||||
//We never expect there to be no data here
|
||||
if (!res.data) {
|
||||
throw res;
|
||||
}
|
||||
return res.data;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user