From 5290f9f57c658d1af7def79da49bd69f62790668 Mon Sep 17 00:00:00 2001 From: Bubka <858858+Bubka@users.noreply.github.com> Date: Fri, 28 Feb 2020 12:05:27 +0100 Subject: [PATCH] Add autosave and feedback to Settings --- resources/js/views/profile/Settings.vue | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/resources/js/views/profile/Settings.vue b/resources/js/views/profile/Settings.vue index b2565c78..4f70ae9e 100644 --- a/resources/js/views/profile/Settings.vue +++ b/resources/js/views/profile/Settings.vue @@ -1,9 +1,8 @@ @@ -37,15 +36,16 @@ this.form.post('/api/settings', {returnError: true}) .then(response => { - this.$router.go() + + this.success = response.data.message + + if(response.data.settings.lang !== this.$root.$i18n.locale) { + this.$router.go() + } }) .catch(error => { - if( error.response.status === 400 ) { - this.fail = error.response.data.message - } - else if( error.response.status !== 422 ) { - this.$router.push({ name: 'genericError', params: { err: error.response } }); - } + + this.fail = error.response.data.message }); } },