From 9b4c3ff311b1d41c6fdb4dbf0e7fc76d38c01bb3 Mon Sep 17 00:00:00 2001 From: Titus Kristiansen <titusk@stud.ntnu.no> Date: Fri, 29 Apr 2022 13:15:57 +0200 Subject: [PATCH] Register fix --- src/components/FormComponents/RegisterForm.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/FormComponents/RegisterForm.vue b/src/components/FormComponents/RegisterForm.vue index 240895b..3f4551a 100644 --- a/src/components/FormComponents/RegisterForm.vue +++ b/src/components/FormComponents/RegisterForm.vue @@ -182,15 +182,15 @@ export default { const loginResponse = await doLogin(loginRequest); - if (loginResponse === "Failed login") { + if (loginResponse.isLoggedIn === false) { this.errorMessage = "Failed to log in with new user"; this.$store.commit("logout"); - this.$router.push("/login"); + await this.$router.push("/login"); return; } - this.$store.commit("saveToken", loginResponse); - this.$router.push("/"); + this.$store.commit("saveToken", loginResponse.token); + await this.$router.push("/"); }, async sendRegisterRequest() { const registerInfo = { -- GitLab