Sidebar Bottom Menu #16
|
@ -1,38 +0,0 @@
|
||||||
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 },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue