어드민 페이지 작업업
This commit is contained in:
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user