styling und routing
This commit is contained in:
@@ -1,29 +1,34 @@
|
||||
// src/app/app.routes.ts
|
||||
import { Routes } from '@angular/router';
|
||||
import { LandingpageComponent } from './features/landingpage/landingpage.component';
|
||||
import { NotFoundComponent } from './core/components/not-found/not-found.component';
|
||||
|
||||
export const routes: Routes = [
|
||||
// REGEL 1: Für alle "normalen" Seiten, nutze das MainLayout
|
||||
// Regel 1: Leerer Pfad (Startseite der Anwendung)
|
||||
// Ein Benutzer, der die Haupt-URL Ihrer Seite aufruft (z.B. "http://localhost:4200/"),
|
||||
// wird sofort und ohne Umwege zur Login-Seite weitergeleitet.
|
||||
{
|
||||
path: '',
|
||||
children: [
|
||||
{ path: '', component: LandingpageComponent }, // ... zeige das Landing-Bild darin
|
||||
// { path: 'shop', loadChildren: ... }, // ... zeige das Shop-Bild darin
|
||||
// { path: 'cart', loadChildren: ... } // ... zeige das Warenkorb-Bild darin
|
||||
],
|
||||
redirectTo: 'auth', // Leitet zur /auth-Route weiter
|
||||
pathMatch: 'full' // Wichtig: Gilt nur für den exakt leeren Pfad
|
||||
},
|
||||
|
||||
// Regel 2: Authentifizierungs-Feature
|
||||
// Alle URLs, die mit "auth/" beginnen (z.B. "/auth/login", "/auth/register"),
|
||||
// werden von dieser Regel abgefangen und an die auth.routes.ts zur
|
||||
// weiteren Verarbeitung übergeben.
|
||||
{
|
||||
path: 'auth',
|
||||
loadChildren: () => import('./features/auth/auth.routes').then(r => r.AUTH_ROUTES)
|
||||
},
|
||||
{
|
||||
path: 'demo',
|
||||
loadChildren: () => import('./features/demo/demo.routes').then(r => r.DEMO_ROUTES)
|
||||
},
|
||||
|
||||
// // REGEL 2: Für alle Authentifizierungs-Seiten, nutze das AuthLayout
|
||||
// {
|
||||
// path: 'auth',
|
||||
// component: AuthLayoutComponent, // <- Hänge den "Auth"-Rahmen an die Wand
|
||||
// children: [
|
||||
// // Annahme: auth.routes.ts definiert /login, /register etc.
|
||||
// { path: '', loadChildren: () => import('./features/auth/auth.routes').then(r => r.AUTH_ROUTES) }
|
||||
// ]
|
||||
// },
|
||||
|
||||
// REGEL 3: Die 404-Seite hat kein spezielles Layout
|
||||
{ path: '**', component: NotFoundComponent },
|
||||
];
|
||||
// Regel 3: Fallback-Route (Wildcard)
|
||||
// JEDE ANDERE URL, die nicht von den obigen Regeln abgefangen wurde,
|
||||
// wird als ungültig betrachtet und ebenfalls zum Auth-Feature (und von dort zum Login) umgeleitet.
|
||||
// Das stellt sicher, dass Benutzer immer auf einer validen Seite landen.
|
||||
{
|
||||
path: '**',
|
||||
redirectTo: 'auth'
|
||||
}
|
||||
];
|
||||
Reference in New Issue
Block a user