Clear persistent data
Clear data that persists and is displayed in monthly graphs for analysis.
This commit is contained in:
@@ -12,42 +12,8 @@ export const loadTransactionsFromStorage = (): Transaction[] => {
|
||||
|
||||
// 기본 샘플 데이터 생성
|
||||
export const createSampleTransactions = (selectedMonth: string): Transaction[] => {
|
||||
return [{
|
||||
id: '1',
|
||||
title: '식료품 구매',
|
||||
amount: 25000,
|
||||
date: `${selectedMonth} 25일, 12:30 PM`,
|
||||
category: '식비',
|
||||
type: 'expense'
|
||||
}, {
|
||||
id: '2',
|
||||
title: '주유소',
|
||||
amount: 50000,
|
||||
date: `${selectedMonth} 24일, 3:45 PM`,
|
||||
category: '교통비',
|
||||
type: 'expense'
|
||||
}, {
|
||||
id: '4',
|
||||
title: '생필품 구매',
|
||||
amount: 35000,
|
||||
date: `${selectedMonth} 18일, 6:00 AM`,
|
||||
category: '생활비',
|
||||
type: 'expense'
|
||||
}, {
|
||||
id: '5',
|
||||
title: '월세',
|
||||
amount: 650000,
|
||||
date: `${selectedMonth} 15일, 10:00 AM`,
|
||||
category: '생활비',
|
||||
type: 'expense'
|
||||
}, {
|
||||
id: '6',
|
||||
title: '식당',
|
||||
amount: 15500,
|
||||
date: `${selectedMonth} 12일, 2:15 PM`,
|
||||
category: '식비',
|
||||
type: 'expense'
|
||||
}];
|
||||
// 샘플 데이터는 생성하지 않고 빈 배열 반환 (초기 상태에서는 데이터가 없어야 함)
|
||||
return [];
|
||||
};
|
||||
|
||||
// 트랜잭션 데이터 저장하기
|
||||
@@ -64,3 +30,19 @@ export const loadBudgetFromStorage = (): number => {
|
||||
}
|
||||
return 1000000; // 기본 예산
|
||||
};
|
||||
|
||||
// 모든 데이터 완전히 초기화
|
||||
export const resetAllStorageData = (): void => {
|
||||
// 트랜잭션 초기화
|
||||
localStorage.removeItem('transactions');
|
||||
localStorage.setItem('transactions', JSON.stringify([]));
|
||||
|
||||
// 월별 지출 데이터 초기화
|
||||
localStorage.removeItem('monthlyExpenses');
|
||||
|
||||
// 예산 초기화
|
||||
localStorage.removeItem('budget');
|
||||
|
||||
console.log('모든 저장소 데이터가 초기화되었습니다.');
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user