From 860834170144575fe6fd2d1b0019f41926a1ca9c Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 30 Dec 2020 19:25:20 +0000 Subject: [PATCH] --- ayanova/src/views/acc-service-bank.vue | 33 ++++---------------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/ayanova/src/views/acc-service-bank.vue b/ayanova/src/views/acc-service-bank.vue index a28d73c0..97ee9d3c 100644 --- a/ayanova/src/views/acc-service-bank.vue +++ b/ayanova/src/views/acc-service-bank.vue @@ -170,7 +170,7 @@ export default { } }, async beforeRouteLeave(to, from, next) { - if (!this.formState.dirty || JUST_DELETED) { + if (!this.formState.dirty || JUST_SAVED) { next(); return; } @@ -306,32 +306,9 @@ export default { vm.formState.serverError = res.error; window.$gz.form.setErrorBoxErrors(vm); } else { - //Logic for detecting if a post or put: if id then it was a post, if no id then it was a put - if (res.data.id) { - //POST - whole new object returned - vm.obj = res.data; - //Change URL to new record - //NOTE: will not cause a page re-render, almost nothing does unless forced with a KEY property or using router.GO() - - this.$router.push({ - name: "service-bank-edit", - params: { - recordid: res.data.id, - obj: res.data, // Pass data object to new form, - name: this.name - } - }); - } else { - //PUT - only concurrency token is returned (**warning, if server changes object other fields then this needs to act more like POST above but is more efficient this way**) - //Handle "put" of an existing record (UPDATE) - vm.obj.concurrency = res.data.concurrency; - } - //Update the form status - window.$gz.form.setFormState({ - vm: vm, - dirty: false, - valid: true - }); + JUST_SAVED = true; + //success, back to list, nothing to see here + vm.$router.go(-1); } } catch (ex) { window.$gz.errorHandler.handleFormError(ex, vm); @@ -498,7 +475,7 @@ function generateMenu(vm) { window.$gz.eventBus.$emit("menu-change", menuOptions); } -let JUST_DELETED = false; +let JUST_SAVED = false; ///////////////////////////////// //