added web-app and landing
This commit is contained in:
parent
af031877a5
commit
769fa105b8
198 changed files with 22132 additions and 10 deletions
12
web-app/src/router/authGuard.ts
Normal file
12
web-app/src/router/authGuard.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// src/router/authGuard.ts
|
||||
import type { NavigationGuardNext, RouteLocationNormalized } from 'vue-router';
|
||||
|
||||
export function authGuard(to: RouteLocationNormalized, from: RouteLocationNormalized, next: NavigationGuardNext): void {
|
||||
const isAuthenticated: boolean = !!localStorage.getItem('authentificated'); // Prüft, ob Token existiert
|
||||
|
||||
if (isAuthenticated) {
|
||||
next(); // Zugriff erlauben
|
||||
} else {
|
||||
next('/login'); // Weiterleitung zur Login-Seite
|
||||
}
|
||||
}
|
||||
35
web-app/src/router/index.ts
Normal file
35
web-app/src/router/index.ts
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import { createRouter, createWebHashHistory } from "vue-router";
|
||||
import HomeView from "../views/HomeView.vue";
|
||||
import { authGuard } from './authGuard';
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory(),
|
||||
routes: [
|
||||
{
|
||||
path: "/",
|
||||
name: "home",
|
||||
redirect: "/stake",
|
||||
},
|
||||
{
|
||||
path: "/stake",
|
||||
name: "stake",
|
||||
meta: {
|
||||
title: "Stake",
|
||||
group: "navbar",
|
||||
layout: 'NavbarLayout'
|
||||
},
|
||||
beforeEnter: authGuard,
|
||||
component: () => import("../views/StakeView.vue"),
|
||||
},
|
||||
{
|
||||
path: "/login",
|
||||
name: "login",
|
||||
meta: {
|
||||
layout: 'DefaultLayout'
|
||||
, },
|
||||
component: () => import("../views/LoginView.vue"),
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export default router;
|
||||
Loading…
Add table
Add a link
Reference in a new issue