Update last sync time

Ensure the last sync time is updated after adding a budget.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-22 06:18:55 +00:00
parent 0d49c4b8ae
commit eb25423b27
5 changed files with 110 additions and 43 deletions

View File

@@ -3,7 +3,7 @@
* 데이터 동기화 메인 모듈
*/
import { isSyncEnabled } from './config';
import { setLastSyncTime } from './time';
import { setLastSyncTime } from '../syncUtils';
import {
BackupData,
SyncResult,
@@ -107,15 +107,20 @@ export const syncAllData = async (userId: string): Promise<SyncResult> => {
// 전체 성공 여부 설정
result.success = result.uploadSuccess || result.downloadSuccess;
// 동기화 시간 기록
// 동기화 시간 기록 - 추가 디버깅 로그 및 중요 부분
if (result.success) {
setLastSyncTime(new Date().toISOString());
const currentTime = new Date().toISOString();
console.log('동기화 성공, 시간 업데이트:', currentTime);
setLastSyncTime(currentTime);
} else {
console.log('동기화 실패, 시간 업데이트 안함');
}
console.log('데이터 동기화 결과:', result);
return result;
} catch (error) {
// 오류 발생 시 백업 데이터 복원
console.error('동기화 중 오류 발생:', error);
recoverFromSyncError(backup, error);
return result;