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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user