Compare commits
No commits in common. "b0b3fa72e10ddf96282faf888c6a59f96058039e" and "1786cc307799386dd949b58d300980368875231e" have entirely different histories.
b0b3fa72e1
...
1786cc3077
|
@ -6,8 +6,8 @@ const simpleLayoutRoutes: Routes = [
|
|||
{
|
||||
path: '',
|
||||
loadComponent: () =>
|
||||
import('./pages/welcome-root/welcome-root.component').then(
|
||||
(m) => m.WelcomeRootComponent
|
||||
import('./pages/register-root/register-root.component').then(
|
||||
(m) => m.RegisterRootComponent
|
||||
),
|
||||
},
|
||||
{
|
||||
|
|
|
@ -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 },
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
|
@ -67,11 +67,11 @@ type AuthAction = 'signin' | 'signup';
|
|||
new ApiConfiguration({ withCredentials: true }),
|
||||
},
|
||||
],
|
||||
templateUrl: './welcome-root.component.html',
|
||||
styleUrl: './welcome-root.component.scss',
|
||||
templateUrl: './register-root.component.html',
|
||||
styleUrl: './register-root.component.scss',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class WelcomeRootComponent implements OnInit {
|
||||
export class RegisterRootComponent implements OnInit {
|
||||
public dialogBackgroundStyle: { 'background-image': string } | null = null;
|
||||
public leftBackgroundStyle: { 'background-image': string } | null = null;
|
||||
public rightBackgroundStyle: { 'background-image': string } | null = null;
|
Loading…
Reference in New Issue