Skip to content
Snippets Groups Projects
Commit 534472aa authored by Titus Netland's avatar Titus Netland
Browse files

Added icons in navbar, fixed login rerouting

parent a68240ad
No related branches found
No related tags found
1 merge request!25Added icons in navbar, fixed login rerouting
Pipeline #176566 passed
src/assets/messages.png

17.2 KiB

src/assets/notifications.png

24.3 KiB

src/assets/profile.png

38.4 KiB

<template>
<div class="App">
<div id="logoField" class="flex justify-center m-6">
<img src="../assets/logo3.svg" alt="BoCo logo" />
</div>
<div
id="emailField"
class="m-6"
:class="{ error: v$.user.email.$errors.length }"
>
:class="{ error: v$.user.email.$errors.length }">
<div class="mb-6">
<label
for="email"
......@@ -102,7 +97,6 @@
import useVuelidate from "@vuelidate/core";
import { required, email, helpers } from "@vuelidate/validators";
import { doLogin } from "@/utils/apiutil";
import { parseUserFromToken } from "@/utils/token-utils";
export default {
name: "LoginForm.vue",
......@@ -160,12 +154,7 @@ export default {
this.$store.commit("logout");
} else if (loginResponse.isLoggedIn === true) {
this.$store.commit("saveToken", loginResponse.token);
let user = parseUserFromToken(loginResponse.token);
console.log(user);
let id = user.accountId;
console.log(id);
await this.$router.push("/profile/" + id);
await this.$router.push('/');
} else {
console.log("Something went wrong");
}
......
<template>
<nav class="flex items-center justify-between bg-white h-20 shadow-2xl">
<div class="logo">
<img class="ml-4 cursor-pointer h-16 " src="../assets/logo3.svg" alt="BoCo logo" @click="$router.push('/')"/>
<img class="m-2 cursor-pointer h-16 " src="../assets/logo3.svg" alt="BoCo logo" @click="$router.push('/')"/>
</div>
<ul class="flex">
<li>
<div class="text-black mr-4 bg-gray-100 p-1 hover:bg-gray-600 transition-all rounded" @click="loadMessages">Meldinger</div>
<img class="m-6 cursor-pointer h-8 " src="../assets/messages.png" alt="Meldinger" @click="$router.push('/messages')"/>
</li>
<li>
<div class="text-black mr-4 bg-gray-100 p-1 hover:bg-gray-600 transition-all rounded" @click="loadNotifications">Varsler</div>
<img class="m-6 cursor-pointer h-8 " src="../assets/notifications.png" alt="Varlser" @click="$router.push('/notifications')"/>
</li>
<li>
<div class="text-black mr-4 bg-gray-100 p-1 hover:bg-gray-600 transition-all rounded" @click="loadProfile">Profil</div>
<img class="m-6 cursor-pointer h-8 " src="../assets/profile.png" alt="Profil" @click="loadProfile"/>
</li>
</ul>
</nav>
......@@ -24,24 +24,6 @@ export default {
name: "NavBar.vue",
methods: {
async loadMessages(){
if(this.$store.state.user.token !== null){
await this.$router.push("/messages")
}
else {
await this.$router.push("/login");
}
},
async loadNotifications(){
if(this.$store.state.user.token !== null){
await this.$router.push("/notifications")
}
else {
await this.$router.push("/login");
}
},
async loadProfile() {
if(this.$store.state.user.token !== null){
let user = parseUserFromToken(this.$store.state.user.token);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment