This commit is contained in:
2020-06-19 23:08:47 +00:00
parent 160d84d954
commit 606f91092f
2 changed files with 41 additions and 48 deletions

View File

@@ -240,7 +240,7 @@ export default {
// }
// }
},
getList: function(urlParams) {
getList: async function(urlParams) {
let vm = this;
if (vm.fetching) {
return;
@@ -253,22 +253,21 @@ export default {
urlParams += "&inactive=true";
}
}
window.$gz.api
.get("pick-list/List" + urlParams)
.then(res => {
vm.fetching = false;
//We never expect there to be no data here
if (!res.data) {
throw res;
}
vm.searchResults = res.data;
window.$gz.form.addNoSelectionItem(vm.searchResults);
vm.replaceLastSelection();
})
.catch(err => {
window.$gz.errorHandler.handleFormError(err);
vm.fetching = false;
});
try {
let res = await window.$gz.api.get("pick-list/List" + urlParams);
vm.fetching = false;
//We never expect there to be no data here
if (!res.data) {
throw res;
}
vm.searchResults = res.data;
window.$gz.form.addNoSelectionItem(vm.searchResults);
vm.replaceLastSelection();
} catch (err) {
window.$gz.errorHandler.handleFormError(err);
vm.fetching = false;
}
},
doSearch: _.debounce(function(searchFor) {
//NOTE debounce with a watcher is a bit different, currently it has to be done exactly this way, nothing else will work properly