261103_03_ENH: 공유 인증 사용자 정보 동기화 및 프로젝트 접근 전환 개선

This commit is contained in:
2026-11-03 15:11:33 +09:00
parent 7f9cbe4f09
commit dd4fc8f230
6 changed files with 134 additions and 5 deletions

View File

@@ -0,0 +1,19 @@
"use client";
import type { ReactNode } from "react";
import { useAuthSession } from "@/hooks/useAuthSession";
export function AuthSessionGate({ children }: { children: ReactNode }) {
const session = useAuthSession();
const user = session.data;
const checking = session.isPending || session.isFetching;
const identity = user && JSON.stringify([user.userId, user.userRole, user.userTeam, user.userCmpn]);
return <>
{session.isError && !checking && <div role="alert" className="p-8 text-center text-sm">
<p>로그인 정보를 확인하지 못했습니다.</p>
<button type="button" onClick={() => { void session.refetch(); }}>다시 시도</button>
</div>}
{user && <div key={identity} hidden={session.isError}>{children}</div>}
</>;
}