사용자 프로필 수정 기능 및 스크립트, 도커 파일 정리 #7

Merged
hyeonsu merged 11 commits from userProfile into dev 2025-08-28 13:51:58 +09:00
3 changed files with 13 additions and 4 deletions
Showing only changes of commit 404984a652 - Show all commits

View File

@ -194,7 +194,7 @@ export function AppLayout({ children }: AppLayoutProps) {
const router = useRouter();
const pathname = usePathname();
const { user, logout, refreshUserData } = useAuth();
const { userMenus, adminMenus, loading } = useMenu();
const { userMenus, adminMenus, loading, refreshMenus } = useMenu();
const [sidebarOpen, setSidebarOpen] = useState(false);
const [expandedMenus, setExpandedMenus] = useState<Set<string>>(new Set());
@ -213,7 +213,7 @@ export function AppLayout({ children }: AppLayoutProps) {
selectImage,
removeImage,
saveProfile,
} = useProfile(user, refreshUserData);
} = useProfile(user, refreshUserData, refreshMenus);
// 현재 경로에 따라 어드민 모드인지 판단
const isAdminMode = pathname.startsWith("/admin");

View File

@ -180,5 +180,6 @@ export const useMenu = (user: any, authLoading: boolean) => {
isMenuLoading: menuState.isLoading,
handleMenuClick,
toggleMenu,
refreshMenus: loadMenuData, // 메뉴 새로고침 함수 추가
};
};

View File

@ -16,7 +16,7 @@ interface AlertModalState {
/**
*
*/
export const useProfile = (user: any, refreshUserData: () => Promise<void>) => {
export const useProfile = (user: any, refreshUserData: () => Promise<void>, refreshMenus?: () => Promise<void>) => {
// 상태 관리
const [modalState, setModalState] = useState<ProfileModalState>({
isOpen: false,
@ -229,7 +229,8 @@ export const useProfile = (user: any, refreshUserData: () => Promise<void>) => {
if (response.result) {
// locale이 변경된 경우 전역 변수와 localStorage 업데이트
if (modalState.formData.locale && modalState.formData.locale !== user.locale) {
const localeChanged = modalState.formData.locale && modalState.formData.locale !== user.locale;
if (localeChanged) {
if (typeof window !== "undefined") {
// 전역 변수 업데이트
(window as any).__GLOBAL_USER_LANG = modalState.formData.locale;
@ -241,6 +242,13 @@ export const useProfile = (user: any, refreshUserData: () => Promise<void>) => {
// 성공: 사용자 정보 새로고침
await refreshUserData();
// locale이 변경된 경우 메뉴도 새로고침
if (localeChanged && refreshMenus) {
console.log("🔄 locale 변경으로 인한 메뉴 새로고침 시작");
await refreshMenus();
console.log("✅ 메뉴 새로고침 완료");
}
setModalState((prev) => ({
...prev,
selectedFile: null,