diff --git a/src/mobile-main.js b/src/mobile-main.js index aa134075..0db26ec9 100644 --- a/src/mobile-main.js +++ b/src/mobile-main.js @@ -299,6 +299,24 @@ Vue.prototype.$showLoading = function (delayConditionFunc, delayMills) { Vue.prototype.$hideLoading = function () { return this.$f7.preloader.hide(); }; +Vue.prototype.$routeBackOnError = function (errorPropertyName) { + const self = this; + const router = self.$f7router; + + const unwatch = self.$watch(errorPropertyName, () => { + if (self[errorPropertyName]) { + setTimeout(() => { + if (unwatch) { + unwatch(); + } + + router.back(); + }, 200); + } + }, { + immediate: true + }); +}; Vue.prototype.$user = userstate; diff --git a/src/views/mobile/accounts/Edit.vue b/src/views/mobile/accounts/Edit.vue index 5adc0b34..2666a967 100644 --- a/src/views/mobile/accounts/Edit.vue +++ b/src/views/mobile/accounts/Edit.vue @@ -1,5 +1,5 @@