diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 871884c..ca351f2 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -9,15 +9,17 @@ import { SharedModule } from './shared/shared.module'; import { HomeComponent } from './core/components/home/home.component'; import { CoreModule } from './core/core.module'; import { AuthGuard } from './core/guards/auth.guard'; +import { SettingsComponent } from './core/components/settings/settings.component'; const routes: Routes = [ - { path: 'home', component: HomeComponent, canActivate: [AuthGuard] }, { path: 'auth', loadChildren: () => import('./core/auth/auth.module').then(m => m.AuthModule) }, - { path: '', redirectTo: 'home', pathMatch: 'full' }, + { path: '', component: HomeComponent, canActivate: [AuthGuard], children: [ + {path: 'settings', component: SettingsComponent} + ]}, ]; @NgModule({ - declarations: [AppComponent], + declarations: [AppComponent, HomeComponent], imports: [ BrowserModule, BrowserAnimationsModule, diff --git a/src/app/core/auth/components/confirm-registration/confirm-registration.component.ts b/src/app/core/auth/components/confirm-registration/confirm-registration.component.ts index 45f15ea..f6f4c8b 100644 --- a/src/app/core/auth/components/confirm-registration/confirm-registration.component.ts +++ b/src/app/core/auth/components/confirm-registration/confirm-registration.component.ts @@ -19,13 +19,20 @@ export class ConfirmRegistrationComponent { constructor( private authService: AuthService, - private activatedRoute: ActivatedRoute + private activatedRoute: ActivatedRoute, + private router: Router ) { this.activatedRoute.params.subscribe( (params) => { this.registrationId = params['registrationId']; } - ) + ); + + this.authService.currentState$.pipe( + filter(state=>state !== undefined && state !== null) + ).subscribe((state) => + this.router.navigateByUrl('/') + ); } confirm(): void { diff --git a/src/app/core/auth/components/login/login.component.ts b/src/app/core/auth/components/login/login.component.ts index d750d33..98577c7 100644 --- a/src/app/core/auth/components/login/login.component.ts +++ b/src/app/core/auth/components/login/login.component.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core'; import { FormControl, FormGroup, Validators } from '@angular/forms'; import { Router } from '@angular/router'; -import { filter } from 'rxjs'; +import { filter, map } from 'rxjs'; import { AuthService } from 'src/app/core/services/auth.service'; @Component({ @@ -20,10 +20,10 @@ export class LoginComponent { private router: Router ) { this.authService.currentState$.pipe( - filter(state => state !== undefined) - ).subscribe(state => { - this.router.navigateByUrl('/home'); - }); + filter(state=>state !== undefined && state !== null) + ).subscribe((state) => + this.router.navigateByUrl('/') + ); } login(): void { diff --git a/src/app/core/auth/components/registration/registration.component.html b/src/app/core/auth/components/registration/registration.component.html index 47a244b..bdcda16 100644 --- a/src/app/core/auth/components/registration/registration.component.html +++ b/src/app/core/auth/components/registration/registration.component.html @@ -20,5 +20,5 @@
Bereits registiert? Jetzt anmelden!
- + diff --git a/src/app/core/auth/components/registration/registration.component.ts b/src/app/core/auth/components/registration/registration.component.ts index 613781b..2502fa4 100644 --- a/src/app/core/auth/components/registration/registration.component.ts +++ b/src/app/core/auth/components/registration/registration.component.ts @@ -20,16 +20,18 @@ export class RegistrationComponent { private router: Router ) { this.authService.currentState$.pipe( - filter(state => state !== undefined) - ).subscribe(state => { - this.router.navigateByUrl('/home'); - }); + filter(state=>state !== undefined && state !== null) + ).subscribe((state) => + this.router.navigateByUrl('/') + ); } - login(): void { + register(): void { this.authService.register({ mail: this.registrationForm.value.mail!, username: this.registrationForm.value.username! }); + + this.router.navigateByUrl('/auth/login'); } } diff --git a/src/app/core/components/home/home.component.html b/src/app/core/components/home/home.component.html index 9194b82..de0a307 100644 --- a/src/app/core/components/home/home.component.html +++ b/src/app/core/components/home/home.component.html @@ -21,4 +21,6 @@This is some placeholder content the Profile tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling.
+This is some placeholder content the Dashboard tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling.
+This is some placeholder content the Settings tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling.
+This is some placeholder content the Contacts tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling.
+