Profile replaces route with query settings=true when enabled.
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
<h2 class="profile__title">{{ emoji }} Welcome {{ username }}</h2>
|
<h2 class="profile__title">{{ emoji }} Welcome {{ username }}</h2>
|
||||||
|
|
||||||
<div class="button--group">
|
<div class="button--group">
|
||||||
<seasoned-button @click="showSettings = !showSettings">{{ showSettings ? 'hide settings' : 'show settings' }}</seasoned-button>
|
<seasoned-button @click="toggleSettings">{{ showSettings ? 'hide settings' : 'show settings' }}</seasoned-button>
|
||||||
|
|
||||||
<seasoned-button @click="logOut">Log out</seasoned-button>
|
<seasoned-button @click="logOut">Log out</seasoned-button>
|
||||||
</div>
|
</div>
|
||||||
@@ -63,11 +63,15 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
toggleSettings() {
|
toggleSettings() {
|
||||||
this.showSettings = this.showSettings ? false : true;
|
this.showSettings = this.showSettings ? false : true;
|
||||||
|
|
||||||
|
if (this.showSettings) {
|
||||||
|
this.$router.replace({ query: { settings: true} })
|
||||||
|
} else {
|
||||||
|
this.$router.replace({ name: 'profile' })
|
||||||
|
}
|
||||||
},
|
},
|
||||||
logOut(){
|
logOut(){
|
||||||
localStorage.clear();
|
this.$router.push('logout')
|
||||||
eventHub.$emit('setUserStatus');
|
|
||||||
this.$router.push({ name: 'home' });
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created(){
|
created(){
|
||||||
@@ -76,6 +80,8 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.userLoggedIn = true;
|
this.userLoggedIn = true;
|
||||||
|
|
||||||
|
this.showSettings = window.location.toString().includes('settings=true')
|
||||||
|
|
||||||
getUserRequests()
|
getUserRequests()
|
||||||
.then(results => {
|
.then(results => {
|
||||||
this.results = results.results
|
this.results = results.results
|
||||||
|
|||||||
Reference in New Issue
Block a user