Skip to content

Commit

Permalink
Add a link to dashboard when logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
joschrew committed Dec 12, 2023
1 parent 7d06db3 commit fc5595b
Showing 1 changed file with 33 additions and 4 deletions.
37 changes: 33 additions & 4 deletions src/layout/navigation-menu/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,20 @@
</div>
<div class="flex ">
<div class="ml-3 mr-3 relative w-max">
<LoginBtnCustom :authService="authService" v-if="isCustomLogin" />
<LoginBtnKeycloak :authService="authService" v-else />
<div v-show="!show_dashboard_link">
<LoginBtnCustom :authService="authService" v-if="isCustomLogin" />
<LoginBtnKeycloak :authService="authService" v-else />
</div>
<button
v-show="show_dashboard_link"
type="button"
class="bg-sky-600 font-medium px-4 py-2 shadow-sm rounded-md text-white
hover:bg-sky-700"
id="dashboard-link-button"
@click="$router.push('dashview/dashboard')"
>
Dashboard
</button>
</div>
</div>
</div>
Expand All @@ -53,17 +65,34 @@ export default {
components: { Search, LoginBtnCustom, LoginBtnKeycloak },
data() {
return {
authService: authService
authService: authService,
show_dashboard_link: false,
};
},
computed: {
isSearchBarVisible() {
return this.$router.currentRoute.path !== "/";
return this.$router.currentRoute.value.path !== "/";
},
isCustomLogin() {
return !this.authService.isKeycloak()
},
},
methods: {
update_show_dashboard_link() {
console.log("router pfad: " + this.$router.currentRoute.value.path);
if (this.authService.isUserLoggedIn()
&& !this.$router.currentRoute.value.path.includes("dashview")) {
console.log("router pfad: ja, zeigen");
this.show_dashboard_link = true;
} else {
console.log("router pfad: nicht zeigen");
this.show_dashboard_link = false;
}
}
},
watch: {
$route: "update_show_dashboard_link",
}
};
</script>

Expand Down

0 comments on commit fc5595b

Please sign in to comment.