diff options
Diffstat (limited to 'app/src/views')
-rw-r--r-- | app/src/views/UserInfo.vue | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/app/src/views/UserInfo.vue b/app/src/views/UserInfo.vue index 04259da..34c87b1 100644 --- a/app/src/views/UserInfo.vue +++ b/app/src/views/UserInfo.vue @@ -7,6 +7,7 @@ <p>Name: {{ me.name }}</p> <p>Email: {{ me.email }}</p> <p>Is staff: {{ me.is_staff }}</p> + <ion-button @click="makeLogout">Logout</ion-button> </div> </ion-content> @@ -36,10 +37,20 @@ export default defineComponent({ created() { if (!this.isLogged) window.location.href = "/sign"; - this.getMe(); + this.getMe() + .then(() => { + if (!this.isLogged) window.location.href = "/sign"; + }) + .catch(() => { + window.location.href = "/sign"; + }); }, methods: { - ...mapActions("auth", ["getMe"]), + makeLogout() { + this.logout(); + window.location.href = "/sign"; + }, + ...mapActions("auth", ["getMe", "logout"]), }, }); </script> |