diff --git a/src/components/UserAuthComponents/LoginForm.vue b/src/components/UserAuthComponents/LoginForm.vue index 4b52c2efef1be63592ab7843f55bcf7a945f4e0d..f13178ceae8c28771bb0e46fc12ffccc98605e81 100644 --- a/src/components/UserAuthComponents/LoginForm.vue +++ b/src/components/UserAuthComponents/LoginForm.vue @@ -94,6 +94,7 @@ import useVuelidate from "@vuelidate/core"; import { required, email, helpers } from "@vuelidate/validators"; import { doLogin } from "@/utils/apiutil"; import Button from "@/components/BaseComponents/ColoredButton"; +import UserService from "@/services/user.service"; export default { name: "LoginForm.vue", @@ -151,6 +152,8 @@ export default { this.message = "Feil e-post/passord"; } else if (loginResponse.isLoggedIn === true) { this.$store.commit("saveToken", loginResponse.token); + const adminList = await UserService.getAdminList(); + this.$store.commit("addAdminList", adminList); await this.$router.push("/"); } }, diff --git a/src/components/UserAuthComponents/RegisterForm.vue b/src/components/UserAuthComponents/RegisterForm.vue index 17cd3cf736afe4e9a3c53d30af6527e7a3d8602a..5750368bd91b5cfd4e7e2738c6603e7e31f8093a 100644 --- a/src/components/UserAuthComponents/RegisterForm.vue +++ b/src/components/UserAuthComponents/RegisterForm.vue @@ -175,6 +175,7 @@ import { helpers, } from "@vuelidate/validators"; import Button from "@/components/BaseComponents/ColoredButton"; +import UserService from "@/services/user.service"; // const isEmailTaken = (value) => // fetch(`/api/unique/${value}`).then((r) => r.json()); // check the email in the server @@ -263,8 +264,10 @@ export default { await this.$router.push("/login"); return; } - + UserService.addAdminsToState(); this.$store.commit("saveToken", loginResponse.token); + const adminList = await UserService.getAdminList(); + this.$store.commit("addAdminList", adminList); await this.$router.push("/"); }, async sendRegisterRequest() {