Clarify data synchronization process
Clarify the data synchronization process and address a scenario where data is lost after logging out, initializing data, and logging back in.
This commit is contained in:
@@ -24,8 +24,15 @@ export const syncAllData = async (userId: string): Promise<void> => {
|
||||
|
||||
try {
|
||||
console.log('데이터 동기화 시작...');
|
||||
|
||||
// 기본 동기화 순서 변경: 서버에서 먼저 다운로드 후, 로컬 데이터 업로드
|
||||
// 이렇게 하면 서버에 저장된 데이터를 먼저 가져온 후, 로컬 변경사항을 반영
|
||||
|
||||
// 1. 서버에서 데이터 다운로드 (기존 데이터 불러오기)
|
||||
await downloadTransactions(userId);
|
||||
await downloadBudgets(userId);
|
||||
|
||||
// 2. 로컬 데이터를 서버에 업로드 (변경사항 반영)
|
||||
await uploadTransactions(userId);
|
||||
await uploadBudgets(userId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user