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:
@@ -26,9 +26,8 @@ export const formatWithCommas = (value: string): string => {
|
||||
return addCommas(removeCommas(value));
|
||||
};
|
||||
|
||||
// 지출 비율 계산 함수 추가
|
||||
// 지출 비율 계산 함수 - 100% 제한 제거
|
||||
export const calculatePercentage = (spent: number, target: number): number => {
|
||||
if (target === 0) return 0;
|
||||
return Math.min(Math.round((spent / target) * 100), 100);
|
||||
return Math.round((spent / target) * 100); // 제한 제거 - 100%를 초과할 수 있음
|
||||
};
|
||||
|
||||
|
||||
@@ -103,6 +103,10 @@ export const resetAllStorageData = (): void => {
|
||||
console.log('[스토리지 초기화] 카테고리 예산 백업 삭제됨');
|
||||
}
|
||||
|
||||
// 중요: 트랜잭션 및 빈 배열로 초기화하여 확실하게 비움
|
||||
localStorage.setItem('transactions', JSON.stringify([]));
|
||||
localStorage.setItem('transactions_backup', JSON.stringify([]));
|
||||
|
||||
console.log('[스토리지 초기화] 완료');
|
||||
} catch (error) {
|
||||
console.error('[스토리지 초기화] 오류:', error);
|
||||
|
||||
Reference in New Issue
Block a user