Retrigger data initialization
Retrigger data initialization process.
This commit is contained in:
@@ -25,9 +25,13 @@ const WelcomeDialog: React.FC<WelcomeDialogProps> = ({ open, onClose }) => {
|
||||
// 다이얼로그 열릴 때 localStorage 값 확인
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
const savedValue = localStorage.getItem('dontShowWelcome');
|
||||
console.log('저장된 dontShowWelcome 값:', savedValue);
|
||||
setDontShowAgain(savedValue === 'true');
|
||||
try {
|
||||
const savedValue = localStorage.getItem('dontShowWelcome');
|
||||
console.log('WelcomeDialog - 저장된 dontShowWelcome 값:', savedValue);
|
||||
setDontShowAgain(savedValue === 'true');
|
||||
} catch (error) {
|
||||
console.error('WelcomeDialog - localStorage 읽기 오류:', error);
|
||||
}
|
||||
}
|
||||
}, [open]);
|
||||
|
||||
@@ -35,22 +39,25 @@ const WelcomeDialog: React.FC<WelcomeDialogProps> = ({ open, onClose }) => {
|
||||
try {
|
||||
// 체크박스가 체크되어 있으면 localStorage에 저장
|
||||
if (dontShowAgain) {
|
||||
// 세션 스토리지와 로컬 스토리지 모두에 저장 (이중 보호)
|
||||
localStorage.setItem('dontShowWelcome', 'true');
|
||||
console.log('dontShowWelcome 값이 true로 저장되었습니다');
|
||||
sessionStorage.setItem('dontShowWelcome', 'true');
|
||||
console.log('WelcomeDialog - dontShowWelcome 값이 true로 저장되었습니다');
|
||||
|
||||
// 확인을 위한 즉시 재확인
|
||||
const savedValue = localStorage.getItem('dontShowWelcome');
|
||||
console.log('저장 직후 확인된 값:', savedValue);
|
||||
console.log('WelcomeDialog - 저장 직후 확인된 값:', savedValue);
|
||||
|
||||
// 토스트 메시지로 사용자에게 알림
|
||||
toast.success('환영 메시지가 다시 표시되지 않도록 설정되었습니다');
|
||||
} else {
|
||||
// 체크 해제 시 null이 아닌 'false' 문자열로 명시적 저장
|
||||
// 체크 해제 시 명시적 'false' 저장
|
||||
localStorage.setItem('dontShowWelcome', 'false');
|
||||
console.log('dontShowWelcome 값이 false로 저장되었습니다');
|
||||
sessionStorage.setItem('dontShowWelcome', 'false');
|
||||
console.log('WelcomeDialog - dontShowWelcome 값이 false로 저장되었습니다');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('localStorage 저장 중 오류 발생:', error);
|
||||
console.error('WelcomeDialog - localStorage 저장 중 오류 발생:', error);
|
||||
}
|
||||
|
||||
// 부모 컴포넌트에 상태 전달
|
||||
|
||||
Reference in New Issue
Block a user