From b6ee1cf906bc768fc97388147a1f959c4f0ceac3 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Thu, 9 Apr 2020 23:00:46 +0200 Subject: [PATCH] Profile replaces route with query settings=true when enabled. --- src/components/Profile.vue | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/Profile.vue b/src/components/Profile.vue index 3504328..0667dc3 100644 --- a/src/components/Profile.vue +++ b/src/components/Profile.vue @@ -5,7 +5,7 @@

{{ emoji }} Welcome {{ username }}

- {{ showSettings ? 'hide settings' : 'show settings' }} + {{ showSettings ? 'hide settings' : 'show settings' }} Log out
@@ -63,11 +63,15 @@ export default { methods: { toggleSettings() { this.showSettings = this.showSettings ? false : true; + + if (this.showSettings) { + this.$router.replace({ query: { settings: true} }) + } else { + this.$router.replace({ name: 'profile' }) + } }, logOut(){ - localStorage.clear(); - eventHub.$emit('setUserStatus'); - this.$router.push({ name: 'home' }); + this.$router.push('logout') } }, created(){ @@ -76,6 +80,8 @@ export default { } else { this.userLoggedIn = true; + this.showSettings = window.location.toString().includes('settings=true') + getUserRequests() .then(results => { this.results = results.results