You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
362 B
17 lines
362 B
import { inject } from "@angular/core";
|
|
import { Router } from "@angular/router";
|
|
import { map } from "rxjs";
|
|
|
|
const accountTokenName = "account";
|
|
|
|
export const authGuard = () => {
|
|
const router = inject(Router);
|
|
const token = localStorage.getItem(accountTokenName);
|
|
|
|
if (!token) {
|
|
router.navigate(["/login"]);
|
|
return false;
|
|
} else {
|
|
return true;
|
|
}
|
|
};
|
|
|