Merge pull request 'refactor: refactor routes.ts' (!212) from refactor/routes into main
Reviewed-on: #212 Reviewed-by: Jan K9f <jan@kjan.email>
This commit is contained in:
commit
8119db68c9
7 changed files with 53 additions and 59 deletions
|
@ -1,12 +1,12 @@
|
||||||
import { Component, HostListener, inject, signal } from '@angular/core';
|
import { Component, HostListener, inject, signal } from '@angular/core';
|
||||||
import { RouterOutlet } from '@angular/router';
|
import { RouterOutlet } from '@angular/router';
|
||||||
import { NavbarComponent } from './shared/components/navbar/navbar.component';
|
import { NavbarComponent } from '@shared/components/navbar/navbar.component';
|
||||||
import { FooterComponent } from './shared/components/footer/footer.component';
|
import { FooterComponent } from '@shared/components/footer/footer.component';
|
||||||
import { LoginComponent } from './feature/auth/login/login.component';
|
import { LoginComponent } from './feature/auth/login/login.component';
|
||||||
import { RegisterComponent } from './feature/auth/register/register.component';
|
import { RegisterComponent } from './feature/auth/register/register.component';
|
||||||
import { RecoverPasswordComponent } from './feature/auth/recover-password/recover-password.component';
|
import RecoverPasswordComponent from './feature/auth/recover-password/recover-password.component';
|
||||||
import { PlaySoundDirective } from './shared/directives/play-sound.directive';
|
import { PlaySoundDirective } from '@shared/directives/play-sound.directive';
|
||||||
import { SoundInitializerService } from './shared/services/sound-initializer.service';
|
import { SoundInitializerService } from '@shared/services/sound-initializer.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
|
|
|
@ -14,75 +14,68 @@ export const routes: Routes = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'verify',
|
path: 'verify',
|
||||||
loadComponent: () =>
|
loadComponent: () => import('./feature/auth/verify-email/verify-email.component'),
|
||||||
import('./feature/auth/verify-email/verify-email.component').then(
|
|
||||||
(m) => m.VerifyEmailComponent
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'recover-password',
|
path: 'recover-password',
|
||||||
loadComponent: () =>
|
loadComponent: () => import('./feature/auth/recover-password/recover-password.component'),
|
||||||
import('./feature/auth/recover-password/recover-password.component').then(
|
|
||||||
(m) => m.RecoverPasswordComponent
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'reset-password',
|
path: 'reset-password',
|
||||||
loadComponent: () =>
|
loadComponent: () => import('./feature/auth/recover-password/recover-password.component'),
|
||||||
import('./feature/auth/recover-password/recover-password.component').then(
|
|
||||||
(m) => m.RecoverPasswordComponent
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'oauth2/callback',
|
path: 'oauth2/callback',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'github',
|
path: 'github',
|
||||||
loadComponent: () =>
|
loadComponent: () => import('./feature/auth/oauth2/oauth2-callback.component'),
|
||||||
import('./feature/auth/oauth2/oauth2-callback.component').then(
|
|
||||||
(m) => m.OAuth2CallbackComponent
|
|
||||||
),
|
|
||||||
data: { provider: 'github' },
|
data: { provider: 'github' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'google',
|
path: 'google',
|
||||||
loadComponent: () =>
|
loadComponent: () => import('./feature/auth/oauth2/oauth2-callback.component'),
|
||||||
import('./feature/auth/oauth2/oauth2-callback.component').then(
|
|
||||||
(m) => m.OAuth2CallbackComponent
|
|
||||||
),
|
|
||||||
data: { provider: 'google' },
|
data: { provider: 'google' },
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'game/blackjack',
|
path: 'game',
|
||||||
loadComponent: () => import('./feature/game/blackjack/blackjack.component'),
|
children: [
|
||||||
canActivate: [authGuard],
|
{
|
||||||
},
|
path: 'blackjack',
|
||||||
{
|
loadComponent: () => import('./feature/game/blackjack/blackjack.component'),
|
||||||
path: 'game/coinflip',
|
canActivate: [authGuard],
|
||||||
loadComponent: () => import('./feature/game/coinflip/coinflip.component'),
|
},
|
||||||
canActivate: [authGuard],
|
{
|
||||||
},
|
path: 'coinflip',
|
||||||
{
|
loadComponent: () => import('./feature/game/coinflip/coinflip.component'),
|
||||||
path: 'game/slots',
|
canActivate: [authGuard],
|
||||||
loadComponent: () => import('./feature/game/slots/slots.component'),
|
},
|
||||||
canActivate: [authGuard],
|
{
|
||||||
},
|
path: 'slots',
|
||||||
{
|
loadComponent: () => import('./feature/game/slots/slots.component'),
|
||||||
path: 'game/lootboxes',
|
canActivate: [authGuard],
|
||||||
loadComponent: () =>
|
},
|
||||||
import('./feature/lootboxes/lootbox-selection/lootbox-selection.component'),
|
{
|
||||||
canActivate: [authGuard],
|
path: 'lootboxes',
|
||||||
},
|
loadComponent: () =>
|
||||||
{
|
import('./feature/lootboxes/lootbox-selection/lootbox-selection.component'),
|
||||||
path: 'game/lootboxes/open/:id',
|
canActivate: [authGuard],
|
||||||
loadComponent: () => import('./feature/lootboxes/lootbox-opening/lootbox-opening.component'),
|
children: [
|
||||||
canActivate: [authGuard],
|
{
|
||||||
},
|
path: 'open/:id',
|
||||||
{
|
loadComponent: () =>
|
||||||
path: 'game/dice',
|
import('./feature/lootboxes/lootbox-opening/lootbox-opening.component'),
|
||||||
loadComponent: () => import('./feature/game/dice/dice.component').then((m) => m.DiceComponent),
|
canActivate: [authGuard],
|
||||||
canActivate: [authGuard],
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'dice',
|
||||||
|
loadComponent: () => import('./feature/game/dice/dice.component'),
|
||||||
|
canActivate: [authGuard],
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
@ -19,7 +19,7 @@ import { Oauth2Service } from './oauth2.service';
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
})
|
})
|
||||||
export class OAuth2CallbackComponent implements OnInit {
|
export default class OAuth2CallbackComponent implements OnInit {
|
||||||
error: Signal<string> = computed(() => this.oauthService.error());
|
error: Signal<string> = computed(() => this.oauthService.error());
|
||||||
|
|
||||||
private route: ActivatedRoute = inject(ActivatedRoute);
|
private route: ActivatedRoute = inject(ActivatedRoute);
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { AuthService } from '@service/auth.service';
|
||||||
imports: [CommonModule, ReactiveFormsModule, RouterModule],
|
imports: [CommonModule, ReactiveFormsModule, RouterModule],
|
||||||
templateUrl: './recover-password.component.html',
|
templateUrl: './recover-password.component.html',
|
||||||
})
|
})
|
||||||
export class RecoverPasswordComponent implements OnInit {
|
export default class RecoverPasswordComponent implements OnInit {
|
||||||
emailForm: FormGroup;
|
emailForm: FormGroup;
|
||||||
resetPasswordForm: FormGroup;
|
resetPasswordForm: FormGroup;
|
||||||
errorMessage = signal('');
|
errorMessage = signal('');
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { AuthService } from '@service/auth.service';
|
||||||
imports: [],
|
imports: [],
|
||||||
templateUrl: './verify-email.component.html',
|
templateUrl: './verify-email.component.html',
|
||||||
})
|
})
|
||||||
export class VerifyEmailComponent implements OnInit {
|
export default class VerifyEmailComponent implements OnInit {
|
||||||
route: ActivatedRoute = inject(ActivatedRoute);
|
route: ActivatedRoute = inject(ActivatedRoute);
|
||||||
router: Router = inject(Router);
|
router: Router = inject(Router);
|
||||||
authService: AuthService = inject(AuthService);
|
authService: AuthService = inject(AuthService);
|
||||||
|
|
|
@ -24,7 +24,7 @@ type DiceFormGroup = FormGroup<{
|
||||||
imports: [CommonModule, ReactiveFormsModule],
|
imports: [CommonModule, ReactiveFormsModule],
|
||||||
templateUrl: './dice.component.html',
|
templateUrl: './dice.component.html',
|
||||||
})
|
})
|
||||||
export class DiceComponent implements OnInit {
|
export default class DiceComponent implements OnInit {
|
||||||
private readonly formBuilder = inject(FormBuilder);
|
private readonly formBuilder = inject(FormBuilder);
|
||||||
private readonly diceService = inject(DiceService);
|
private readonly diceService = inject(DiceService);
|
||||||
private readonly userService = inject(UserService);
|
private readonly userService = inject(UserService);
|
||||||
|
|
|
@ -11,7 +11,8 @@ import { ActivatedRoute, RouterLink } from '@angular/router';
|
||||||
import { AuthService } from '@service/auth.service';
|
import { AuthService } from '@service/auth.service';
|
||||||
import { LoginComponent } from '../auth/login/login.component';
|
import { LoginComponent } from '../auth/login/login.component';
|
||||||
import { RegisterComponent } from '../auth/register/register.component';
|
import { RegisterComponent } from '../auth/register/register.component';
|
||||||
import { RecoverPasswordComponent } from '../auth/recover-password/recover-password.component';
|
import '../auth/recover-password/recover-password.component';
|
||||||
|
import RecoverPasswordComponent from '../auth/recover-password/recover-password.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-landing-page',
|
selector: 'app-landing-page',
|
||||||
|
|
Reference in a new issue