diff --git a/support-portal-frontend/src/app/component/login/login.component.ts b/support-portal-frontend/src/app/component/login/login.component.ts index 643e87d..7497669 100644 --- a/support-portal-frontend/src/app/component/login/login.component.ts +++ b/support-portal-frontend/src/app/component/login/login.component.ts @@ -1,15 +1,31 @@ -import {Component, OnInit} from '@angular/core'; +import {Component, OnDestroy, OnInit} from '@angular/core'; +import {Router} from "@angular/router"; +import {AuthenticationService} from "../../service/authentication.service"; +import {NotificationService} from "../../service/notification.service"; +import {NotificationType} from "../../notification/notification-type"; @Component({ selector: 'app-login', templateUrl: './login.component.html', styleUrls: ['./login.component.css'] }) -export class LoginComponent implements OnInit { +export class LoginComponent implements OnInit, OnDestroy { - constructor() { } + constructor(private router: Router, + private authenticationService: AuthenticationService, + private notificationService: NotificationService) { + } ngOnInit(): void { + if (this.authenticationService.isUserLoggedIn()) { + this.router.navigateByUrl("/user/management"); + this.notificationService.notify(NotificationType.INFO, "You are already logged in"); + } else { + // this.router.navigateByUrl("/login"); + } + } + + ngOnDestroy(): void { } }