Skip to content

Commit

Permalink
fix(AuthGateway): redirect to permission page if not employee
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianAndersen committed Aug 23, 2024
1 parent 8799a7a commit 74440a2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/app/auth-gateway/auth-gateway.component.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import { Component, OnInit } from "@angular/core";
import { Router } from "@angular/router";
import { AuthService } from "../auth/auth.service";

@Component({
selector: "app-auth-gateway",
templateUrl: "./auth-gateway.component.html",
})
export class AuthGatewayComponent implements OnInit {
constructor(private router: Router) {}
constructor(private router: Router, private authService: AuthService) {}

ngOnInit(): void {
setTimeout(() => {
this.router.navigate(["/"], { replaceUrl: true });
this.router.navigate(
[
this.authService.isEmployee()
? "/"
: "/auth/permission/denied",
],
{ replaceUrl: true }
);
}, 200);
}
}

0 comments on commit 74440a2

Please sign in to comment.