From 0d09a4eac92da6d8dd2de91ce7ad5fea1e75116d Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Tue, 15 Nov 2022 21:16:26 +0100 Subject: Redirect if a login expires --- app/src/views/UserInfo.vue | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'app/src/views/UserInfo.vue') 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 @@

Name: {{ me.name }}

Email: {{ me.email }}

Is staff: {{ me.is_staff }}

+ Logout @@ -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"]), }, }); -- cgit v1.2.3-18-g5258