forked from baron/baron-sso
백엔드 호출 제거 및 문서화
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
import { BadgeCheck, LogOut, Moon, ShieldHalf, Sun, User } from "lucide-react";
|
||||
import { BadgeCheck, LogOut, Moon, ShieldHalf, Sun } from "lucide-react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useAuth } from "react-oidc-context";
|
||||
import { NavLink, Outlet } from "react-router-dom";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { t } from "../../lib/i18n";
|
||||
import { Toaster } from "../ui/toaster";
|
||||
import { fetchMe } from "../../features/auth/authApi";
|
||||
|
||||
const navItems = [
|
||||
{
|
||||
@@ -18,11 +16,16 @@ const navItems = [
|
||||
|
||||
function AppLayout() {
|
||||
const auth = useAuth();
|
||||
const { data: profile } = useQuery({
|
||||
queryKey: ["me"],
|
||||
queryFn: fetchMe,
|
||||
enabled: auth.isAuthenticated,
|
||||
});
|
||||
|
||||
// OIDC ID Token에서 프로필 정보 추출
|
||||
// auth.user?.profile에는 OIDC 표준 클레임(sub, email, name 등)이 포함됨
|
||||
const profile = auth.user?.profile ? {
|
||||
id: auth.user.profile.sub,
|
||||
email: auth.user.profile.email,
|
||||
name: (auth.user.profile.name as string) || (auth.user.profile.preferred_username as string) || auth.user.profile.email,
|
||||
tenantId: auth.user.profile.tenant_id as string,
|
||||
tenant: auth.user.profile.tenant as any,
|
||||
} : null;
|
||||
|
||||
const [theme, setTheme] = useState<"light" | "dark">(() => {
|
||||
const stored = window.localStorage.getItem("admin_theme");
|
||||
|
||||
Reference in New Issue
Block a user