Fix: Data reset not clearing transactions

Ensures that the data reset function correctly clears all transaction data from local storage.
This commit is contained in:
gpt-engineer-app[bot]
2025-04-05 05:48:21 +00:00
parent d96a43ef44
commit 03e9671ec6
5 changed files with 33 additions and 6 deletions

View File

@@ -78,9 +78,18 @@ export const useDataReset = () => {
}
}
// 데이터 초기화
// 데이터 초기화 (개선된 메소드 사용)
resetAllStorageData();
// 추가 초기화를 위해 빈 데이터 명시적 설정
localStorage.setItem('transactions', JSON.stringify([]));
localStorage.setItem('budgetData', JSON.stringify({
daily: {targetAmount: 0, spentAmount: 0, remainingAmount: 0},
weekly: {targetAmount: 0, spentAmount: 0, remainingAmount: 0},
monthly: {targetAmount: 0, spentAmount: 0, remainingAmount: 0}
}));
localStorage.setItem('categoryBudgets', JSON.stringify({}));
// 사용자 설정 복원
if (dontShowWelcomeValue) {
localStorage.setItem('dontShowWelcome', dontShowWelcomeValue);
@@ -139,8 +148,10 @@ export const useDataReset = () => {
console.log('모든 데이터 초기화 완료');
// 페이지 리프레시 대신 navigate 사용 (딜레이 제거)
navigate('/settings', { replace: true });
// 페이지 리프레시를 위해 잠시 후에 새로고침
setTimeout(() => {
window.location.reload();
}, 500);
return { isCloudResetSuccess: cloudResetSuccess };
} catch (error) {