Clear persistent data

Clear data that persists and is displayed in monthly graphs for analysis.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-15 22:59:37 +00:00
parent 829b7af80d
commit 2ba8fdc31b
3 changed files with 47 additions and 39 deletions

View File

@@ -92,13 +92,19 @@ export const clearAllBudgetData = (): void => {
// 모든 데이터 초기화 (첫 로그인 상태)
export const resetAllData = (): void => {
// 모든 관련 데이터 키 목록
// 모든 관련 데이터 키 목록 (분석 페이지의 데이터 포함)
const dataKeys = [
'transactions',
'categoryBudgets',
'budgetData',
'budget',
'hasVisitedBefore'
'hasVisitedBefore',
'monthlyExpenses', // 월간 지출 데이터
'categorySpending', // 카테고리별 지출 데이터
'expenseAnalytics', // 지출 분석 데이터
'expenseHistory', // 지출 이력
'budgetHistory', // 예산 이력
'analyticsCache' // 분석 캐시 데이터
];
// 모든 관련 데이터 키 삭제
@@ -108,5 +114,23 @@ export const resetAllData = (): void => {
clearAllTransactions();
clearAllCategoryBudgets();
clearAllBudgetData();
// 추가적으로 사용자 기기에 저장된 모든 데이터 검사
for (let i = 0; i < localStorage.length; i++) {
const key = localStorage.key(i);
if (key && (
key.includes('expense') ||
key.includes('budget') ||
key.includes('transaction') ||
key.includes('analytics') ||
key.includes('spending') ||
key.includes('financial')
)) {
console.log(`추가 데이터 삭제: ${key}`);
localStorage.removeItem(key);
}
}
console.log('모든 데이터가 초기화되었습니다.');
};