Files
XRLMS/lib/auth.ts

36 lines
781 B
TypeScript
Raw Normal View History

/**
*
*/
/**
*
* @returns
*/
export function isAdminLoggedIn(): boolean {
if (typeof window === 'undefined') {
return false;
}
return localStorage.getItem('isAdminLoggedIn') === 'true';
}
/**
*
*
*/
export function requireAdminAuth(): boolean {
if (typeof window === 'undefined') {
return false;
}
const isAdmin = isAdminLoggedIn();
if (!isAdmin) {
// 관리자 인증되지 않은 경우 로그인 페이지로 리다이렉트
window.location.href = '/login';
return false;
}
return true;
}