Reset budget and transaction data
Resets all budget data and transaction history to provide a clean slate.
This commit is contained in:
@@ -27,21 +27,19 @@ const Index = () => {
|
||||
const { user } = useAuth();
|
||||
const [showWelcome, setShowWelcome] = useState(false);
|
||||
|
||||
// 첫 방문 여부 확인 및 데이터 초기화
|
||||
// 화면이 처음 로드될 때 데이터 초기화
|
||||
useEffect(() => {
|
||||
const hasVisitedBefore = localStorage.getItem('hasVisitedBefore');
|
||||
const dontShowWelcome = localStorage.getItem('dontShowWelcome') === 'true';
|
||||
// 데이터를 완전히 초기화
|
||||
resetAllData();
|
||||
|
||||
if (!hasVisitedBefore) {
|
||||
// 첫 로그인으로 가정하고 모든 데이터 초기화
|
||||
resetAllData();
|
||||
setShowWelcome(true);
|
||||
// 방문 기록 저장
|
||||
localStorage.setItem('hasVisitedBefore', 'true');
|
||||
} else if (!dontShowWelcome) {
|
||||
// '더 이상 보지 않기'를 선택하지 않았다면 계속 환영 팝업 표시
|
||||
// 환영 다이얼로그 표시 여부 결정
|
||||
const dontShowWelcome = localStorage.getItem('dontShowWelcome') === 'true';
|
||||
if (!dontShowWelcome) {
|
||||
setShowWelcome(true);
|
||||
}
|
||||
|
||||
// 방문 기록 저장 (초기화 후에 저장)
|
||||
localStorage.setItem('hasVisitedBefore', 'true');
|
||||
}, []);
|
||||
|
||||
// 환영 팝업 닫기
|
||||
|
||||
Reference in New Issue
Block a user