Fix type error in SupabaseConnectionTest
The TestResults type was not assignable to the TestResult type in the SupabaseConnectionTest component. This commit ensures the types are compatible.
This commit is contained in:
@@ -2,18 +2,10 @@
|
||||
import React from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { ArrowRight, Shield } from "lucide-react";
|
||||
import { TestResults } from "@/lib/supabase/tests/types";
|
||||
|
||||
interface TestResultProps {
|
||||
testResults: {
|
||||
url?: string;
|
||||
usingProxy?: boolean;
|
||||
proxyUrl?: string;
|
||||
client?: boolean;
|
||||
restApi?: boolean;
|
||||
auth?: boolean;
|
||||
database?: boolean;
|
||||
errors: string[];
|
||||
} | null;
|
||||
testResults: TestResults | null;
|
||||
}
|
||||
|
||||
const SupabaseConnectionStatus: React.FC<TestResultProps> = ({ testResults }) => {
|
||||
|
||||
@@ -3,10 +3,11 @@ import React, { useState } from "react";
|
||||
import { RefreshCw } from "lucide-react";
|
||||
import { testSupabaseConnection } from "@/lib/supabase";
|
||||
import { useToast } from "@/hooks/useToast.wrapper";
|
||||
import { TestResults } from "@/lib/supabase/tests/types";
|
||||
|
||||
interface TestConnectionSectionProps {
|
||||
setLoginError: (error: string | null) => void;
|
||||
setTestResults: (results: any) => void;
|
||||
setTestResults: (results: TestResults) => void;
|
||||
}
|
||||
|
||||
const TestConnectionSection: React.FC<TestConnectionSectionProps> = ({
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import React, { useState } from 'react';
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { RefreshCw, Info, HelpCircle, AlertCircle } from "lucide-react";
|
||||
@@ -6,22 +5,10 @@ import { toast } from "@/hooks/useToast.wrapper";
|
||||
import { testSupabaseConnection } from '@/lib/supabase';
|
||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
|
||||
import { Alert, AlertTitle, AlertDescription } from "@/components/ui/alert";
|
||||
|
||||
interface TestResult {
|
||||
url: string;
|
||||
proxyUrl: string;
|
||||
usingProxy: boolean;
|
||||
proxyType?: string;
|
||||
client: boolean;
|
||||
restApi: boolean;
|
||||
auth: boolean;
|
||||
database: boolean;
|
||||
errors: string[];
|
||||
debugInfo?: any;
|
||||
}
|
||||
import { TestResults } from '@/lib/supabase/tests/types';
|
||||
|
||||
const SupabaseConnectionTest: React.FC = () => {
|
||||
const [testResults, setTestResults] = useState<TestResult | null>(null);
|
||||
const [testResults, setTestResults] = useState<TestResults | null>(null);
|
||||
const [isTesting, setIsTesting] = useState(false);
|
||||
const [showDebug, setShowDebug] = useState(false);
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ export const testSupabaseConnection = async (): Promise<TestResults> => {
|
||||
// 기본 결과 객체 초기화
|
||||
const results: TestResults = {
|
||||
url: getSupabaseUrl(),
|
||||
proxyUrl: '', // 빈 문자열로 초기화
|
||||
usingProxy: isCorsProxyEnabled(),
|
||||
proxyType: getProxyType(),
|
||||
client: true,
|
||||
@@ -27,6 +28,22 @@ export const testSupabaseConnection = async (): Promise<TestResults> => {
|
||||
return results;
|
||||
}
|
||||
|
||||
// CORS 프록시 URL 설정
|
||||
if (results.usingProxy) {
|
||||
const baseUrl = getSupabaseUrl();
|
||||
const proxyType = getProxyType();
|
||||
|
||||
if (proxyType === 'corsproxy.io') {
|
||||
results.proxyUrl = `https://corsproxy.io/?${encodeURIComponent(baseUrl)}`;
|
||||
} else if (proxyType === 'cors-anywhere') {
|
||||
results.proxyUrl = `https://cors-anywhere.herokuapp.com/${baseUrl}`;
|
||||
} else {
|
||||
results.proxyUrl = baseUrl; // 기본값
|
||||
}
|
||||
} else {
|
||||
results.proxyUrl = results.url; // 프록시 사용 안 함
|
||||
}
|
||||
|
||||
// 테스트 실행
|
||||
const authResults = await testAuth(supabase, results.url);
|
||||
const apiResults = await testRestApi(supabase);
|
||||
|
||||
@@ -8,6 +8,7 @@ export interface TestResult {
|
||||
|
||||
export interface TestResults {
|
||||
url: string;
|
||||
proxyUrl: string; // 추가된 필드
|
||||
usingProxy: boolean;
|
||||
proxyType: string;
|
||||
client: boolean;
|
||||
|
||||
Reference in New Issue
Block a user