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

Merge branch 'navbar_icons' into 'main'

Added icons in navbar, fixed login rerouting

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

17.2 KiB

src/assets/notifications.png

24.3 KiB

src/assets/profile.png

38.4 KiB

<template> <template>
<div class="App"> <div class="App">
<div id="logoField" class="flex justify-center m-6">
<img src="../assets/logo3.svg" alt="BoCo logo" />
</div>
<div <div
id="emailField" id="emailField"
class="m-6" class="m-6"
:class="{ error: v$.user.email.$errors.length }" :class="{ error: v$.user.email.$errors.length }">
>
<div class="mb-6"> <div class="mb-6">
<label <label
for="email" for="email"
...@@ -102,7 +97,6 @@ ...@@ -102,7 +97,6 @@
import useVuelidate from "@vuelidate/core"; import useVuelidate from "@vuelidate/core";
import { required, email, helpers } from "@vuelidate/validators"; import { required, email, helpers } from "@vuelidate/validators";
import { doLogin } from "@/utils/apiutil"; import { doLogin } from "@/utils/apiutil";
import { parseUserFromToken } from "@/utils/token-utils";
export default { export default {
name: "LoginForm.vue", name: "LoginForm.vue",
...@@ -160,12 +154,7 @@ export default { ...@@ -160,12 +154,7 @@ export default {
this.$store.commit("logout"); this.$store.commit("logout");
} else if (loginResponse.isLoggedIn === true) { } else if (loginResponse.isLoggedIn === true) {
this.$store.commit("saveToken", loginResponse.token); this.$store.commit("saveToken", loginResponse.token);
await this.$router.push('/');
let user = parseUserFromToken(loginResponse.token);
console.log(user);
let id = user.accountId;
console.log(id);
await this.$router.push("/profile/" + id);
} else { } else {
console.log("Something went wrong"); console.log("Something went wrong");
} }
......
<template> <template>
<nav class="flex items-center justify-between bg-white h-20 shadow-2xl"> <nav class="flex items-center justify-between bg-white h-20 shadow-2xl">
<div class="logo"> <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> </div>
<ul class="flex"> <ul class="flex">
<li> <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>
<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>
<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> </li>
</ul> </ul>
</nav> </nav>
...@@ -24,24 +24,6 @@ export default { ...@@ -24,24 +24,6 @@ export default {
name: "NavBar.vue", name: "NavBar.vue",
methods: { 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() { async loadProfile() {
if(this.$store.state.user.token !== null){ if(this.$store.state.user.token !== null){
let user = parseUserFromToken(this.$store.state.user.token); let user = parseUserFromToken(this.$store.state.user.token);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment