어드민 페이지 작업업

This commit is contained in:
mota
2025-10-31 00:02:36 +09:00
parent 293e4a20b9
commit d4aab34e43
4 changed files with 300 additions and 235 deletions

View File

@@ -56,13 +56,19 @@ export function AppHeader() {
setOpenSlug(null);
}, 150);
}, [cancelClose]);
// 카테고리 로드
React.useEffect(() => {
// 카테고리 로드 + 외부에서 새로고침 트리거 지원
const reloadCategories = React.useCallback(() => {
fetch("/api/categories", { cache: "no-store" })
.then((r) => r.json())
.then((d) => setCategories(d?.categories || []))
.catch(() => setCategories([]));
}, []);
React.useEffect(() => {
reloadCategories();
const onRefresh = () => reloadCategories();
window.addEventListener("categories:reload", onRefresh);
return () => window.removeEventListener("categories:reload", onRefresh);
}, [reloadCategories]);
// ESC로 메가메뉴 닫기
React.useEffect(() => {