Ensure sync is disabled

The sync setting was not consistently being disabled in certain scenarios. This change ensures that the sync setting is properly disabled when expected.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-18 01:48:38 +00:00
parent dfb9d8ca69
commit 043db23836
5 changed files with 59 additions and 25 deletions

View File

@@ -1,3 +1,4 @@
import { Transaction } from '@/components/TransactionCard';
// 트랜잭션 데이터 불러오기
@@ -99,7 +100,7 @@ export const resetAllStorageData = (): void => {
'budgetHistory',
'transactionHistory',
'lastSync',
'syncEnabled', // 동기화 설정도 초기화 (변경된 부분)
'syncEnabled', // 동기화 설정도 초기화
];
// 키 삭제
@@ -153,14 +154,16 @@ export const resetAllStorageData = (): void => {
localStorage.setItem('supabase.auth.token', supabase);
}
// 동기화 설정은 OFF로 설정 (변경된 부분)
// 동기화 설정은 무조건 OFF로 설정
localStorage.setItem('syncEnabled', 'false');
console.log('동기화 설정이 OFF로 변경되었습니다');
// 이벤트 발생
window.dispatchEvent(new Event('transactionUpdated'));
window.dispatchEvent(new Event('budgetDataUpdated'));
window.dispatchEvent(new Event('categoryBudgetsUpdated'));
window.dispatchEvent(new StorageEvent('storage'));
window.dispatchEvent(new Event('auth-state-changed')); // 동기화 상태 변경 이벤트 추가
console.log('모든 저장소 데이터가 완전히 초기화되었습니다. (동기화 설정이 OFF로 변경됨)');
} catch (error) {