Fix budget synchronization issue

Ensure budget data is synchronized correctly after local data deletion.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-16 10:11:09 +00:00
parent c3ddd3b88f
commit b0177ba5cd
4 changed files with 136 additions and 49 deletions

View File

@@ -55,10 +55,18 @@ const SyncSettings = () => {
const result = await trySyncAllData(user.id);
if (result.success) {
toast({
title: "동기화 설정 완료",
description: "모든 데이터가 클라우드에 동기화되었습니다.",
});
if (result.partial) {
toast({
title: "동기화 일부 완료",
description: "일부 데이터만 동기화되었습니다. 다시 시도해보세요.",
variant: "warning"
});
} else {
toast({
title: "동기화 설정 완료",
description: "모든 데이터가 클라우드에 동기화되었습니다.",
});
}
setLastSync(getLastSyncTime());
} else {
toast({
@@ -98,19 +106,34 @@ const SyncSettings = () => {
const result = await trySyncAllData(user.id);
if (result.success) {
toast({
title: "동기화 완료",
description: "모든 데이터가 클라우드에 동기화되었습니다.",
});
if (result.downloadSuccess && result.uploadSuccess) {
toast({
title: "동기화 완료",
description: "모든 데이터가 클라우드에 동기화되었습니다.",
});
} else if (result.downloadSuccess) {
toast({
title: "다운로드만 성공",
description: "서버 데이터를 가져왔지만, 업로드에 실패했습니다.",
variant: "warning"
});
} else if (result.uploadSuccess) {
toast({
title: "업로드만 성공",
description: "로컬 데이터를 업로드했지만, 다운로드에 실패했습니다.",
variant: "warning"
});
}
setLastSync(getLastSyncTime());
} else {
toast({
title: "일부 동기화 실패",
description: "일부 데이터 동기화 중 문제가 발생했습니다.",
description: "일부 데이터 동기화 중 문제가 발생했습니다. 다시 시도해주세요.",
variant: "destructive"
});
}
} catch (error) {
console.error('동기화 오류:', error);
toast({
title: "동기화 오류",
description: "동기화 중 문제가 발생했습니다. 다시 시도해주세요.",
@@ -124,6 +147,8 @@ const SyncSettings = () => {
const formatLastSyncTime = () => {
if (!lastSync) return "아직 동기화된 적 없음";
if (lastSync === '부분-다운로드') return "부분 동기화 (다운로드만)";
const date = new Date(lastSync);
return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
};