23 lines
623 B
TypeScript
23 lines
623 B
TypeScript
import { Router } from '@angular/router';
|
|
import { AuthService } from 'src/app/shared/services/auth.service';
|
|
import { Component, OnInit } from '@angular/core';
|
|
|
|
@Component({
|
|
selector: 'app-main-page',
|
|
templateUrl: './main-page.component.html',
|
|
styleUrls: ['./main-page.component.scss']
|
|
})
|
|
export class MainPageComponent implements OnInit {
|
|
|
|
constructor(private auth: AuthService, private router: Router) { }
|
|
|
|
ngOnInit(): void {
|
|
this.auth.authStatusChanged.subscribe((isAuthenticated) => {
|
|
if (!isAuthenticated) {
|
|
this.router.navigateByUrl('login');
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|