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 React from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { ArrowRight, Shield } from "lucide-react";
|
import { ArrowRight, Shield } from "lucide-react";
|
||||||
|
import { TestResults } from "@/lib/supabase/tests/types";
|
||||||
|
|
||||||
interface TestResultProps {
|
interface TestResultProps {
|
||||||
testResults: {
|
testResults: TestResults | null;
|
||||||
url?: string;
|
|
||||||
usingProxy?: boolean;
|
|
||||||
proxyUrl?: string;
|
|
||||||
client?: boolean;
|
|
||||||
restApi?: boolean;
|
|
||||||
auth?: boolean;
|
|
||||||
database?: boolean;
|
|
||||||
errors: string[];
|
|
||||||
} | null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const SupabaseConnectionStatus: React.FC<TestResultProps> = ({ testResults }) => {
|
const SupabaseConnectionStatus: React.FC<TestResultProps> = ({ testResults }) => {
|
||||||
|
|||||||
@@ -3,10 +3,11 @@ import React, { useState } from "react";
|
|||||||
import { RefreshCw } from "lucide-react";
|
import { RefreshCw } from "lucide-react";
|
||||||
import { testSupabaseConnection } from "@/lib/supabase";
|
import { testSupabaseConnection } from "@/lib/supabase";
|
||||||
import { useToast } from "@/hooks/useToast.wrapper";
|
import { useToast } from "@/hooks/useToast.wrapper";
|
||||||
|
import { TestResults } from "@/lib/supabase/tests/types";
|
||||||
|
|
||||||
interface TestConnectionSectionProps {
|
interface TestConnectionSectionProps {
|
||||||
setLoginError: (error: string | null) => void;
|
setLoginError: (error: string | null) => void;
|
||||||
setTestResults: (results: any) => void;
|
setTestResults: (results: TestResults) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TestConnectionSection: React.FC<TestConnectionSectionProps> = ({
|
const TestConnectionSection: React.FC<TestConnectionSectionProps> = ({
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { RefreshCw, Info, HelpCircle, AlertCircle } from "lucide-react";
|
import { RefreshCw, Info, HelpCircle, AlertCircle } from "lucide-react";
|
||||||
@@ -6,22 +5,10 @@ import { toast } from "@/hooks/useToast.wrapper";
|
|||||||
import { testSupabaseConnection } from '@/lib/supabase';
|
import { testSupabaseConnection } from '@/lib/supabase';
|
||||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
|
||||||
import { Alert, AlertTitle, AlertDescription } from "@/components/ui/alert";
|
import { Alert, AlertTitle, AlertDescription } from "@/components/ui/alert";
|
||||||
|
import { TestResults } from '@/lib/supabase/tests/types';
|
||||||
interface TestResult {
|
|
||||||
url: string;
|
|
||||||
proxyUrl: string;
|
|
||||||
usingProxy: boolean;
|
|
||||||
proxyType?: string;
|
|
||||||
client: boolean;
|
|
||||||
restApi: boolean;
|
|
||||||
auth: boolean;
|
|
||||||
database: boolean;
|
|
||||||
errors: string[];
|
|
||||||
debugInfo?: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
const SupabaseConnectionTest: React.FC = () => {
|
const SupabaseConnectionTest: React.FC = () => {
|
||||||
const [testResults, setTestResults] = useState<TestResult | null>(null);
|
const [testResults, setTestResults] = useState<TestResults | null>(null);
|
||||||
const [isTesting, setIsTesting] = useState(false);
|
const [isTesting, setIsTesting] = useState(false);
|
||||||
const [showDebug, setShowDebug] = useState(false);
|
const [showDebug, setShowDebug] = useState(false);
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ export const testSupabaseConnection = async (): Promise<TestResults> => {
|
|||||||
// 기본 결과 객체 초기화
|
// 기본 결과 객체 초기화
|
||||||
const results: TestResults = {
|
const results: TestResults = {
|
||||||
url: getSupabaseUrl(),
|
url: getSupabaseUrl(),
|
||||||
|
proxyUrl: '', // 빈 문자열로 초기화
|
||||||
usingProxy: isCorsProxyEnabled(),
|
usingProxy: isCorsProxyEnabled(),
|
||||||
proxyType: getProxyType(),
|
proxyType: getProxyType(),
|
||||||
client: true,
|
client: true,
|
||||||
@@ -27,6 +28,22 @@ export const testSupabaseConnection = async (): Promise<TestResults> => {
|
|||||||
return results;
|
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 authResults = await testAuth(supabase, results.url);
|
||||||
const apiResults = await testRestApi(supabase);
|
const apiResults = await testRestApi(supabase);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ export interface TestResult {
|
|||||||
|
|
||||||
export interface TestResults {
|
export interface TestResults {
|
||||||
url: string;
|
url: string;
|
||||||
|
proxyUrl: string; // 추가된 필드
|
||||||
usingProxy: boolean;
|
usingProxy: boolean;
|
||||||
proxyType: string;
|
proxyType: string;
|
||||||
client: boolean;
|
client: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user