This commit is contained in:
2020-06-19 23:00:45 +00:00
parent f79fed7154
commit 160d84d954

View File

@@ -483,8 +483,9 @@ export default {
//i is the actual AyaNova index of vm record so we have all we need to open vm object //i is the actual AyaNova index of vm record so we have all we need to open vm object
window.$gz.eventBus.$emit("openobject", { type: typeToOpen, id: i }); window.$gz.eventBus.$emit("openobject", { type: typeToOpen, id: i });
}, },
getDataFromApi() { async getDataFromApi() {
let vm = this; let vm = this;
if (vm.loading) { if (vm.loading) {
return; return;
} }
@@ -507,22 +508,20 @@ export default {
//this puts a pin in it then resets it after the fetch is completed //this puts a pin in it then resets it after the fetch is completed
let preSelected = [...vm.selected]; let preSelected = [...vm.selected];
try {
//untokenize ListView date token criteria (if there are any) //untokenize ListView date token criteria (if there are any)
let untokenizedListView = untokenizeListView(vm.listView); let untokenizedListView = untokenizeListView(vm.listView);
window.$gz.api let res = await window.$gz.api.upsert(vm.apiBaseUrl, {
.upsert(vm.apiBaseUrl, {
offset: listOptions.Offset, offset: listOptions.Offset,
limit: listOptions.Limit, limit: listOptions.Limit,
dataListKey: vm.dataListKey, dataListKey: vm.dataListKey,
listView: untokenizedListView listView: untokenizedListView
}) });
.then(res => {
if (res.error) { if (res.error) {
throw res.error; throw res.error;
} else { } else {
//NOTE: This is how to call an async function and await it from sync code
(async function() {
//Save a copy of the server columns data for handling button clicks etc later //Save a copy of the server columns data for handling button clicks etc later
vm.serverColumns = res.columns; vm.serverColumns = res.columns;
//Make sure the translation keys are fetched //Make sure the translation keys are fetched
@@ -540,17 +539,13 @@ export default {
//persist the paging options and listview stuff so user sees same page and list on refresh or leave and return scenario //persist the paging options and listview stuff so user sees same page and list on refresh or leave and return scenario
saveFormSettings(vm); saveFormSettings(vm);
//////////
})();
} }
}) } catch (err) {
.catch(err => {
window.$gz.errorHandler.handleFormError(err, vm); window.$gz.errorHandler.handleFormError(err, vm);
}) } finally {
.finally(function() {
vm.loading = false; vm.loading = false;
vm.formState.ready = true; vm.formState.ready = true;
}); }
} }
}, },
created() { created() {