Remove on-premise Supabase code
\ Removes code related to on-premise Supabase connections, ensuring the application uses the cloud version.
This commit is contained in:
@@ -2,8 +2,7 @@
|
||||
import { Transaction } from '@/components/TransactionCard';
|
||||
import { supabase } from '@/lib/supabase';
|
||||
import { isSyncEnabled } from '@/utils/syncUtils';
|
||||
import { useAuth } from '@/contexts/auth/AuthProvider';
|
||||
import { formatISO, parseISO } from 'date-fns';
|
||||
import { formatISO } from 'date-fns';
|
||||
|
||||
// ISO 형식으로 날짜 변환 (Supabase 저장용)
|
||||
const convertDateToISO = (dateStr: string): string => {
|
||||
@@ -43,7 +42,7 @@ const convertDateToISO = (dateStr: string): string => {
|
||||
}
|
||||
};
|
||||
|
||||
// Supabase와 트랜잭션 동기화
|
||||
// Supabase와 트랜잭션 동기화 - Cloud 최적화 버전
|
||||
export const syncTransactionsWithSupabase = async (user: any, transactions: Transaction[]): Promise<Transaction[]> => {
|
||||
if (!user || !isSyncEnabled()) return transactions;
|
||||
|
||||
@@ -90,7 +89,7 @@ export const syncTransactionsWithSupabase = async (user: any, transactions: Tran
|
||||
return transactions;
|
||||
};
|
||||
|
||||
// Supabase에 트랜잭션 업데이트
|
||||
// Supabase에 트랜잭션 업데이트 - Cloud 최적화 버전
|
||||
export const updateTransactionInSupabase = async (user: any, transaction: Transaction): Promise<void> => {
|
||||
if (!user || !isSyncEnabled()) return;
|
||||
|
||||
@@ -119,7 +118,7 @@ export const updateTransactionInSupabase = async (user: any, transaction: Transa
|
||||
}
|
||||
};
|
||||
|
||||
// Supabase에서 트랜잭션 삭제
|
||||
// Supabase에서 트랜잭션 삭제 - Cloud 최적화 버전
|
||||
export const deleteTransactionFromSupabase = async (user: any, transactionId: string): Promise<void> => {
|
||||
if (!user || !isSyncEnabled()) return;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { deleteTransactionFromSupabase } from '../../supabaseUtils';
|
||||
import { toast } from '@/hooks/useToast.wrapper';
|
||||
|
||||
/**
|
||||
* 스토리지 및 Supabase 삭제 처리 - 완전히 개선된 버전
|
||||
* 스토리지 및 Supabase 삭제 처리 - Supabase Cloud에 최적화된 버전
|
||||
*/
|
||||
export const handleDeleteStorage = (
|
||||
updatedTransactions: Transaction[],
|
||||
@@ -34,22 +34,24 @@ export const handleDeleteStorage = (
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. Supabase 삭제는 백그라운드로 처리 (결과는 기다리지 않음)
|
||||
// 2. Supabase Cloud 삭제는 백그라운드로 처리 (결과는 기다리지 않음)
|
||||
const deleteFromSupabase = async () => {
|
||||
try {
|
||||
const timeoutPromise = new Promise<void>((_, reject) => {
|
||||
setTimeout(() => reject(new Error('Supabase 삭제 타임아웃')), 3000);
|
||||
});
|
||||
|
||||
// Promise.race로 타임아웃 처리
|
||||
// Supabase Cloud에 최적화된 삭제 요청
|
||||
await Promise.race([
|
||||
deleteTransactionFromSupabase(user, id),
|
||||
timeoutPromise
|
||||
new Promise((_, reject) => setTimeout(() => reject(new Error('Supabase 삭제 타임아웃')), 5000))
|
||||
]);
|
||||
|
||||
console.log('Supabase 삭제 성공:', id);
|
||||
} catch (error) {
|
||||
console.error('Supabase 삭제 실패 (백그라운드 작업):', error);
|
||||
// 삭제 실패 알림 (선택적)
|
||||
toast({
|
||||
title: "동기화 문제",
|
||||
description: "클라우드 데이터 삭제에 실패했습니다. 나중에 다시 시도합니다.",
|
||||
variant: "default"
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user