Revert sync behavior after data reset

The sync setting should be disabled after data reset.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-18 01:28:18 +00:00
parent b96e0877b7
commit 5f269040fd
4 changed files with 9 additions and 16 deletions

View File

@@ -43,8 +43,8 @@ const DataResetDialog: React.FC<DataResetDialogProps> = ({
.
</div>
{syncEnabled && (
<div className="mt-2 text-neuro-income">
.
<div className="mt-2 text-amber-600">
.
</div>
)}
</>

View File

@@ -16,7 +16,7 @@ const SyncExplanation: React.FC<SyncExplanationProps> = ({ enabled }) => {
<AlertTitle className="text-black"> </AlertTitle>
<AlertDescription className="text-sm text-black">
. .
.
.
</AlertDescription>
</Alert>
);

View File

@@ -1,4 +1,3 @@
import { Transaction } from '@/components/TransactionCard';
// 트랜잭션 데이터 불러오기
@@ -77,8 +76,6 @@ export const resetAllStorageData = (): void => {
const authSession = localStorage.getItem('authSession');
const sbAuth = localStorage.getItem('sb-auth-token');
const supabase = localStorage.getItem('supabase.auth.token');
// 동기화 설정 백업 (변경된 부분)
const syncEnabled = localStorage.getItem('syncEnabled');
// 모든 Storage 키 목록 (로그인 관련 항목 제외)
const keysToRemove = [
@@ -102,7 +99,7 @@ export const resetAllStorageData = (): void => {
'budgetHistory',
'transactionHistory',
'lastSync',
// 'syncEnabled' 제거됨 - 동기화 설정은 보존
'syncEnabled', // 동기화 설정도 초기화 (변경된 부분)
];
// 키 삭제
@@ -156,11 +153,8 @@ export const resetAllStorageData = (): void => {
localStorage.setItem('supabase.auth.token', supabase);
}
// 동기화 설정 복원 (변경된 부분)
if (syncEnabled) {
localStorage.setItem('syncEnabled', syncEnabled);
console.log('동기화 설정 복원:', syncEnabled);
}
// 동기화 설정은 OFF로 설정 (변경된 부분)
localStorage.setItem('syncEnabled', 'false');
// 이벤트 발생
window.dispatchEvent(new Event('transactionUpdated'));
@@ -168,7 +162,7 @@ export const resetAllStorageData = (): void => {
window.dispatchEvent(new Event('categoryBudgetsUpdated'));
window.dispatchEvent(new StorageEvent('storage'));
console.log('모든 저장소 데이터가 완전히 초기화되었습니다. (로그인 상태와 동기화 설정 유지)');
console.log('모든 저장소 데이터가 완전히 초기화되었습니다. (동기화 설정이 OFF로 변경됨)');
} catch (error) {
console.error('데이터 초기화 중 오류:', error);
}

View File

@@ -54,11 +54,10 @@ export const clearCloudData = async (userId: string): Promise<boolean> => {
}
// 동기화 설정 초기화 및 마지막 동기화 시간 초기화
// 변경: 동기화 설정을 비활성화하지 않고 마지막 동기화 시간만 초기화
localStorage.removeItem('lastSync');
// localStorage.setItem('syncEnabled', 'false'); 이 줄 제거
localStorage.setItem('syncEnabled', 'false'); // 동기화 설정을 OFF로 변경 (수정된 부분)
console.log('클라우드 데이터 초기화 완료');
console.log('클라우드 데이터 초기화 완료 및 동기화 설정 OFF');
return true;
} catch (error) {
console.error('클라우드 데이터 초기화 중 오류 발생:', error);