12 lines
397 B
JavaScript
12 lines
397 B
JavaScript
import { inject } from '@angular/core';
|
|
import { AdminAuthService } from './admin-auth.service';
|
|
/** Guards `/admin/**`-style routes. Never shares state with the customer auth guard/service. */
|
|
export const adminAuthGuard = () => {
|
|
const adminAuth = inject(AdminAuthService);
|
|
if (adminAuth.isAuthenticated()) {
|
|
return true;
|
|
}
|
|
adminAuth.requestLogin();
|
|
return false;
|
|
};
|