added web-app and landing

This commit is contained in:
johba 2025-09-23 14:18:04 +02:00
parent af031877a5
commit 769fa105b8
198 changed files with 22132 additions and 10 deletions

View 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
}
}

View 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;