show credits

This commit is contained in:
jaehwang committed 2026-09-16 10:46:33 +09:00
1 parent d59304f833
commit 49b4178453
8 files changed
+115 -13

No files matched your search

+28 -9
View File
@@ -8,7 +8,7 @@
* GIS 스크립트는 여기서 붙인다. 로그인 화면에 오기 전에는 서드파티 요청을 만들지 않는다.
*/
import { useEffect, useState } from "react";
import { useEffect, useSyncExternalStore } from "react";
import { apiFetch } from "@/lib/api";
const SCRIPT_URL = "https://accounts.google.com/gsi/client?hl=ko";
@@ -105,18 +105,37 @@ export const signIn = (credential: string) =>
export const signOut = () => apiFetch<{ ok: boolean }>("/api/auth/logout", { method: "POST" });
// 로그인 정보는 화면 여러 곳이 같이 본다 — 사이드바 배지와 페이지가 따로 들고 있으면
// 한쪽에서 갱신해도 다른 쪽이 옛 값을 그린다. 한 군데 두고 나눠 쓴다
let cached: Me | null | false = null;
const listeners = new Set<() => void>();
function publish(next: Me | null | false) {
cached = next;
listeners.forEach((notify) => notify());
}
function subscribe(notify: () => void) {
listeners.add(notify);
return () => { listeners.delete(notify); };
}
/** 서버에 다시 물어본다. 잡을 만든 뒤처럼 남은 개수가 바뀌는 자리에서 부른다 */
export function refreshMe(): Promise<void> {
return apiFetch<Me>("/api/auth/me")
.then((me) => publish(me))
.catch(() => publish(false));
}
export const setMe = publish;
/** 로그인 여부. null 이면 아직 확인 중, false 면 로그아웃 상태 */
export function useMe() {
const [me, setMe] = useState<Me | null | false>(null);
const refresh = () =>
apiFetch<Me>("/api/auth/me").then(setMe).catch(() => setMe(false));
const me = useSyncExternalStore(subscribe, () => cached, () => null);
useEffect(() => {
// eslint-disable-next-line react-hooks/set-state-in-effect -- 최초 1회 확인
refresh();
// eslint-disable-next-line react-hooks/exhaustive-deps
if (cached === null) refreshMe();
}, []);
return { me, refresh, setMe };
return { me, refresh: refreshMe, setMe: publish };
}
+3 -1
View File
@@ -3,9 +3,11 @@
* 백엔드에 대응하는 API가 없는 화면을 여기서 끈다 — 페이지 코드는 그대로 두고
* 네비게이션에서 감추고 본문 대신 안내를 띄운다.
*
* styling /studio — /api/f2 없음
* styling /studio — /api/f2 없음
* playreelEntry — 무빙포스터 화면에서 롱컷으로 넘어가는 자리. 임시로 닫아둠
*/
export const FEATURES = {
styling: false,
archive: true,
playreelEntry: false,
} as const;