Fix type errors in sync settings

This commit addresses several TypeScript errors in the sync settings component and related utility functions. It corrects type definitions for the sync result, ensures correct usage of the `setLastSyncTime` function, and fixes toast variants.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-16 10:13:54 +00:00
parent b0177ba5cd
commit f2a941c3da
3 changed files with 20 additions and 9 deletions

View File

@@ -49,8 +49,18 @@ export const syncAllData = async (userId: string): Promise<void> => {
}
};
// trySyncAllData의 반환 타입 명시적 정의
// 동기화 결과를 위한 인터페이스 정의
export interface SyncResult {
success: boolean;
partial?: boolean;
downloadSuccess?: boolean;
uploadSuccess?: boolean;
error?: any;
}
// 안전하게 동기화 시도하는 함수 개선
export const trySyncAllData = async (userId: string): Promise<{ success: boolean, error?: any }> => {
export const trySyncAllData = async (userId: string): Promise<SyncResult> => {
if (!userId || !isSyncEnabled()) return { success: true };
let downloadSuccess = false;
@@ -93,7 +103,7 @@ export const trySyncAllData = async (userId: string): Promise<{ success: boolean
}
// 하나라도 성공했으면 부분 성공으로 간주
const result = {
const result: SyncResult = {
success: downloadSuccess || uploadSuccess,
partial: (downloadSuccess && !uploadSuccess) || (!downloadSuccess && uploadSuccess),
downloadSuccess,