Refactor category budget setting
The category budget setting is now based on the monthly budget amount, which is then divided into daily and weekly budgets.
This commit is contained in:
@@ -23,18 +23,18 @@ export const resetAllData = (): void => {
|
||||
'categoryBudgets',
|
||||
'budgetData',
|
||||
'budget',
|
||||
'monthlyExpenses', // 월간 지출 데이터
|
||||
'categorySpending', // 카테고리별 지출 데이터
|
||||
'expenseAnalytics', // 지출 분석 데이터
|
||||
'expenseHistory', // 지출 이력
|
||||
'budgetHistory', // 예산 이력
|
||||
'analyticsCache', // 분석 캐시 데이터
|
||||
'monthlyTotals', // 월간 합계 데이터
|
||||
'analytics', // 분석 페이지 데이터
|
||||
'dailyBudget', // 일일 예산
|
||||
'weeklyBudget', // 주간 예산
|
||||
'monthlyBudget', // 월간 예산
|
||||
'chartData', // 차트 데이터
|
||||
'monthlyExpenses',
|
||||
'categorySpending',
|
||||
'expenseAnalytics',
|
||||
'expenseHistory',
|
||||
'budgetHistory',
|
||||
'analyticsCache',
|
||||
'monthlyTotals',
|
||||
'analytics',
|
||||
'dailyBudget',
|
||||
'weeklyBudget',
|
||||
'monthlyBudget',
|
||||
'chartData',
|
||||
];
|
||||
|
||||
try {
|
||||
@@ -42,6 +42,7 @@ export const resetAllData = (): void => {
|
||||
dataKeys.forEach(key => {
|
||||
console.log(`삭제 중: ${key}`);
|
||||
localStorage.removeItem(key);
|
||||
localStorage.removeItem(`${key}_backup`); // 백업 키도 함께 삭제
|
||||
});
|
||||
|
||||
// 파일별 초기화 함수 호출
|
||||
@@ -61,19 +62,15 @@ export const resetAllData = (): void => {
|
||||
localStorage.setItem('transactions_backup', JSON.stringify([]));
|
||||
|
||||
// 이벤트 발생시켜 데이터 로드 트리거 - 이벤트 순서 최적화
|
||||
try {
|
||||
// 한 번에 모든 이벤트 발생
|
||||
const events = [
|
||||
new Event('transactionUpdated'),
|
||||
new Event('budgetDataUpdated'),
|
||||
new Event('categoryBudgetsUpdated'),
|
||||
new StorageEvent('storage')
|
||||
];
|
||||
|
||||
events.forEach(event => window.dispatchEvent(event));
|
||||
} catch (e) {
|
||||
console.error('이벤트 발생 오류:', e);
|
||||
}
|
||||
const events = [
|
||||
new Event('transactionUpdated'),
|
||||
new Event('budgetDataUpdated'),
|
||||
new Event('categoryBudgetsUpdated'),
|
||||
new StorageEvent('storage')
|
||||
];
|
||||
|
||||
// 모든 이벤트 동시에 발생
|
||||
events.forEach(event => window.dispatchEvent(event));
|
||||
|
||||
// 중요: 사용자 설정 값 복원 (백업한 값이 있는 경우)
|
||||
if (dontShowWelcomeValue) {
|
||||
|
||||
Reference in New Issue
Block a user