diff --git a/package.json b/package.json index 5af2c3d..a1913f8 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "react-dom": "^18.2.0", "swiper": "^11.1.3" }, - "homepage": "https://bam-j.github.io/pages/", + "homepage": "https://hanaro-trip-together-bank.github.io/TripTogether-front/", "devDependencies": { "@chromatic-com/storybook": "^1.4.0", "@storybook/addon-essentials": "^8.1.1", diff --git a/src/hooks/useFetch.ts b/src/hooks/useFetch.ts index 86c4aa7..4881c3c 100644 --- a/src/hooks/useFetch.ts +++ b/src/hooks/useFetch.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable react-hooks/exhaustive-deps */ import { useEffect, useState } from "react"; import useToggle from "./useToggle"; @@ -14,17 +15,18 @@ type FetchMethod = "GET" | "POST" | "PUT" | "DELETE"; export function useFetch( uri: string, - method: FetchMethod, - requestData: RequestDtoType | null = null + _method: FetchMethod, + _requestData: RequestDtoType | null = null ) { const { blocked } = useCommunicationBlock(); const [isLoading, setIsLoading] = useState(false); - const [error, setError] = useState(""); + const [error] = useState(""); const [data, setData] = useState(); const [trigger, toggleTrigger] = useToggle(); //데모용 fetch useEffect(() => { + if (blocked || !uri) return; setIsLoading(true); setTimeout(() => { console.log(replaceNumbersWithZero(uri)); diff --git a/src/hooks/useFetchTrigger.ts b/src/hooks/useFetchTrigger.ts index ecfc6b6..3aad7fa 100644 --- a/src/hooks/useFetchTrigger.ts +++ b/src/hooks/useFetchTrigger.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { useState } from "react"; import demoData from "../utils/demoData"; import replaceNumbersWithZero from "../utils/replaceNumberWithZero"; @@ -10,19 +11,20 @@ type FetchMethod = "GET" | "POST" | "PUT" | "DELETE"; // 이후 useEffect를 통해 처리 로직 만들면 됨 // ex) useEffect(()=>{ if(data) alert(data) },[data]); -export function useFetchTrigger( +export function useFetchTrigger<_RequestDtoType, ResponseDtoType>( uri: string, - method: FetchMethod + _method: FetchMethod ) { const [isLoading, setIsLoading] = useState(false); - const [error, setError] = useState(); + const [error] = useState(); const [data, setData] = useState(); const [controller] = useState(new AbortController()); const abort = () => controller.abort(); //데모용 trigger - const trigger = () => { + const trigger = (a: unknown = "") => { + console.log(a); setIsLoading(true); setTimeout(() => { setData(demoData[replaceNumbersWithZero(uri)] as ResponseDtoType); diff --git a/src/pages/SelectCountryPage.tsx b/src/pages/SelectCountryPage.tsx index f63c079..24a480a 100644 --- a/src/pages/SelectCountryPage.tsx +++ b/src/pages/SelectCountryPage.tsx @@ -33,7 +33,7 @@ export default function SelectCountryPage({ info }: SelectCountryPageProps) { ); useEffect(() => { - countriesFetch.trigger(null); + countriesFetch.trigger(); }, [selected]); useEffect(() => {