Compare commits

..

No commits in common. "b0b3fa72e10ddf96282faf888c6a59f96058039e" and "1786cc307799386dd949b58d300980368875231e" have entirely different histories.

7 changed files with 43 additions and 5 deletions

View File

@ -6,8 +6,8 @@ const simpleLayoutRoutes: Routes = [
{ {
path: '', path: '',
loadComponent: () => loadComponent: () =>
import('./pages/welcome-root/welcome-root.component').then( import('./pages/register-root/register-root.component').then(
(m) => m.WelcomeRootComponent (m) => m.RegisterRootComponent
), ),
}, },
{ {

View File

@ -0,0 +1,38 @@
import { HttpErrorResponse } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { SuccessDtoApiModel } from '../../api';
import { AuthService } from '../../shared/service';
@Component({
selector: 'app-foo',
standalone: true,
providers: [],
imports: [],
templateUrl: './home-root.component.html',
styleUrl: './home-root.component.scss',
})
export class HomeComponent implements OnInit {
public constructor(
private readonly authService: AuthService,
private readonly router: Router
) {}
public ngOnInit(): void {
this.authService.status().subscribe(
(response: SuccessDtoApiModel) => {
if (response.success) {
this.router.navigate(['/dashboard']);
}
},
(error: HttpErrorResponse) => {
if (error.status === 401) {
this.router.navigate(['welcome'], {
queryParams: { login: true },
});
}
}
);
}
}

View File

@ -67,11 +67,11 @@ type AuthAction = 'signin' | 'signup';
new ApiConfiguration({ withCredentials: true }), new ApiConfiguration({ withCredentials: true }),
}, },
], ],
templateUrl: './welcome-root.component.html', templateUrl: './register-root.component.html',
styleUrl: './welcome-root.component.scss', styleUrl: './register-root.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
}) })
export class WelcomeRootComponent implements OnInit { export class RegisterRootComponent implements OnInit {
public dialogBackgroundStyle: { 'background-image': string } | null = null; public dialogBackgroundStyle: { 'background-image': string } | null = null;
public leftBackgroundStyle: { 'background-image': string } | null = null; public leftBackgroundStyle: { 'background-image': string } | null = null;
public rightBackgroundStyle: { 'background-image': string } | null = null; public rightBackgroundStyle: { 'background-image': string } | null = null;