From 2b9f3cada7a21de456dd191e9b93716c7f8e806d Mon Sep 17 00:00:00 2001 From: 2NNS-V Date: Thu, 5 Sep 2024 14:12:19 +0900 Subject: [PATCH 01/10] =?UTF-8?q?feat:=20value=20=EA=B0=92=20=EC=98=81?= =?UTF-8?q?=EC=96=B4=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/form/DropDown.tsx | 40 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/components/form/DropDown.tsx b/src/components/form/DropDown.tsx index 09f7c65..c60a2a5 100644 --- a/src/components/form/DropDown.tsx +++ b/src/components/form/DropDown.tsx @@ -12,26 +12,26 @@ export interface DropDownProps { export default function DropDown({ color, width, height, selectedMajor, setSelectedMajor }: DropDownProps) { const majors = [ - { label: "πŸ“– μΈλ¬ΈλŒ€ν•™", value: "μΈλ¬ΈλŒ€ν•™" }, - { label: "πŸ“‹ μ‚¬νšŒκ³Όν•™λŒ€ν•™", value: "μ‚¬νšŒκ³Όν•™λŒ€ν•™" }, - { label: "πŸ”¬ μžμ—°κ³Όν•™λŒ€ν•™", value: "μžμ—°κ³Όν•™λŒ€ν•™" }, - { label: "πŸ“Š κ²½μƒλŒ€ν•™", value: "κ²½μƒλŒ€ν•™" }, - { label: "πŸ› οΈ κ³΅κ³ΌλŒ€ν•™", value: "κ³΅κ³ΌλŒ€ν•™" }, - { label: "πŸ’» ITλŒ€ν•™", value: "ITλŒ€ν•™" }, - { label: "πŸ₯• 농업생λͺ…κ³Όν•™λŒ€ν•™", value: "농업생λͺ…κ³Όν•™λŒ€ν•™" }, - { label: "🎨 μ˜ˆμˆ λŒ€ν•™", value: "μ˜ˆμˆ λŒ€ν•™" }, - { label: "πŸ“š μ‚¬λ²”λŒ€ν•™", value: "μ‚¬λ²”λŒ€ν•™" }, - { label: "πŸ₯Ό μ˜κ³ΌλŒ€ν•™", value: "μ˜κ³ΌλŒ€ν•™" }, - { label: "🦷 μΉ˜κ³ΌλŒ€ν•™", value: "μΉ˜κ³ΌλŒ€ν•™" }, - { label: "🐈 μˆ˜μ˜κ³ΌλŒ€ν•™", value: "μˆ˜μ˜κ³ΌλŒ€ν•™" }, - { label: "🧼 μƒν™œκ³Όν•™λŒ€ν•™", value: "μƒν™œκ³Όν•™λŒ€ν•™" }, - { label: "πŸ’‰ κ°„ν˜ΈλŒ€ν•™", value: "κ°„ν˜ΈλŒ€ν•™" }, - { label: "πŸ’Š μ•½ν•™λŒ€ν•™", value: "μ•½ν•™λŒ€ν•™" }, - { label: "πŸš™ μ²¨λ‹¨κΈ°μˆ μœ΅ν•©λŒ€ν•™", value: "μ²¨λ‹¨κΈ°μˆ μœ΅ν•©λŒ€ν•™" }, - { label: "πŸͺ΅ μƒνƒœν™˜κ²½λŒ€ν•™", value: "μƒνƒœν™˜κ²½λŒ€ν•™" }, - { label: "πŸ“‘ κ³Όν•™κΈ°μˆ λŒ€ν•™", value: "κ³Όν•™κΈ°μˆ λŒ€ν•™" }, - { label: "πŸ–‹οΈ ν–‰μ •ν•™λΆ€", value: "ν–‰μ •ν•™λΆ€" }, - { label: "πŸ’‘ μžμœ¨μ „κ³΅λΆ€", value: "μžμœ¨μ „κ³΅λΆ€" }, + { label: "πŸ“– μΈλ¬ΈλŒ€ν•™", value: "humanities" }, + { label: "πŸ“‹ μ‚¬νšŒκ³Όν•™λŒ€ν•™", value: "social-sciences" }, + { label: "πŸ”¬ μžμ—°κ³Όν•™λŒ€ν•™", value: "natural-sciences" }, + { label: "πŸ“Š κ²½μƒλŒ€ν•™", value: "economics" }, + { label: "πŸ› οΈ κ³΅κ³ΌλŒ€ν•™", value: "engineering" }, + { label: "πŸ’» ITλŒ€ν•™", value: "it" }, + { label: "πŸ₯• 농업생λͺ…κ³Όν•™λŒ€ν•™", value: "agriculture" }, + { label: "🎨 μ˜ˆμˆ λŒ€ν•™", value: "arts" }, + { label: "πŸ“š μ‚¬λ²”λŒ€ν•™", value: "teachers" }, + { label: "πŸ₯Ό μ˜κ³ΌλŒ€ν•™", value: "medicine" }, + { label: "🦷 μΉ˜κ³ΌλŒ€ν•™", value: "dentisty" }, + { label: "🐈 μˆ˜μ˜κ³ΌλŒ€ν•™", value: "vet" }, + { label: "🧼 μƒν™œκ³Όν•™λŒ€ν•™", value: "human-sciences" }, + { label: "πŸ’‰ κ°„ν˜ΈλŒ€ν•™", value: "nursing" }, + { label: "πŸ’Š μ•½ν•™λŒ€ν•™", value: "pharmacy" }, + { label: "πŸš™ μ²¨λ‹¨κΈ°μˆ μœ΅ν•©λŒ€ν•™", value: "advanced-technology" }, + { label: "πŸͺ΅ μƒνƒœν™˜κ²½λŒ€ν•™", value: "environment" }, + { label: "πŸ“‘ κ³Όν•™κΈ°μˆ λŒ€ν•™", value: "science-technology" }, + { label: "πŸ–‹οΈ ν–‰μ •ν•™λΆ€", value: "administration" }, + { label: "πŸ’‘ μžμœ¨μ „κ³΅λΆ€", value: "undeclared" }, ]; return ( From 515ac6954a29cb482d58deb9a206314a5df0cb41 Mon Sep 17 00:00:00 2001 From: 2NNS-V Date: Thu, 5 Sep 2024 19:08:17 +0900 Subject: [PATCH 02/10] =?UTF-8?q?chore:=20=EB=A9=94=EC=9D=B8=20=EC=9D=B4?= =?UTF-8?q?=EB=AF=B8=EC=A7=80=20=EB=B0=B0=EA=B2=BD=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/images/main.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/images/main.svg b/src/assets/images/main.svg index bccf109..a67a3e5 100644 --- a/src/assets/images/main.svg +++ b/src/assets/images/main.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file From 6f96cd1ce1d7034679cfa8a087fbb31cb2e79de4 Mon Sep 17 00:00:00 2001 From: 2NNS-V Date: Thu, 5 Sep 2024 23:29:55 +0900 Subject: [PATCH 03/10] =?UTF-8?q?feat:=20Axios=20=ED=9B=85=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useAxios.tsx | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/hooks/useAxios.tsx diff --git a/src/hooks/useAxios.tsx b/src/hooks/useAxios.tsx new file mode 100644 index 0000000..6423085 --- /dev/null +++ b/src/hooks/useAxios.tsx @@ -0,0 +1,37 @@ +import React from "react"; + +import axios from "axios"; +import { AxiosRequestConfig } from "axios"; + +const instance = axios.create({ + baseURL: "https://api.dongbti.com", + withCredentials: true, +}); + +export default function useAxios(config: AxiosRequestConfig, dependencies: any[] = []) { + const [data, setData] = React.useState(null); + const [loading, setLoading] = React.useState(false); + const [error, setError] = React.useState(null); + + React.useEffect(() => { + const fetchData = async () => { + setLoading(true); + try { + const response = await instance(config); + setData(response.data); + console.log(response.data); + } catch (err: any) { + if (axios.isAxiosError(err)) { + setError(err.message || "Something went wrong"); + } else { + setError("Something went wrong"); + } + } finally { + setLoading(false); + } + }; + fetchData(); + }, dependencies); + + return { data, loading, error }; +} From b28b0d93d54f7910989ffa7b3374d16e7ffb3257 Mon Sep 17 00:00:00 2001 From: 2NNS-V Date: Thu, 5 Sep 2024 23:31:21 +0900 Subject: [PATCH 04/10] =?UTF-8?q?feat:=20=EC=A0=84=EC=B2=B4=20=ED=86=B5?= =?UTF-8?q?=EA=B3=84=20API=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/HomePage.tsx | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/src/pages/HomePage.tsx b/src/pages/HomePage.tsx index 461a207..c6f4af0 100644 --- a/src/pages/HomePage.tsx +++ b/src/pages/HomePage.tsx @@ -8,6 +8,8 @@ import { Input } from "@/components/form/Input"; import { SideBar } from "@/components/navigation/SideBar"; import { Text } from "@/components/typography/Text"; +import useAxios from "@/hooks/useAxios"; + import menuIcon from "@/assets/icons/menu.svg"; import main from "@/assets/images/main.svg"; @@ -23,6 +25,10 @@ import { } from "./HomePage.style"; import { useUserInfo } from "@/store/store"; +interface axiosProps { + total_count: number; +} + export default function HomePage() { const navigate = useNavigate(); @@ -37,6 +43,14 @@ export default function HomePage() { setIsOpen(!isOpen); }; + const { data, loading, error } = useAxios( + { + url: `/stats/total`, + method: "GET", + }, + [], + ); + React.useEffect(() => { setMajor(selectedMajor); }, [selectedMajor, setMajor]); @@ -109,11 +123,23 @@ export default function HomePage() { - μ˜€λŠ˜κΉŒμ§€ - - 39,239λͺ… - - 이 μ°Έμ—¬ν–ˆμ–΄μš”! + {loading && μ°Έμ—¬μž 수λ₯Ό λΆˆλŸ¬μ˜€λŠ” 쀑...} + + {error && ( + + μ°Έμ—¬μž 수λ₯Ό λΆˆλŸ¬μ˜€λŠ”λ° μ‹€νŒ¨ν–ˆμ–΄μš”. + + )} + + {data && ( + <> + μ˜€λŠ˜κΉŒμ§€ + + {data.total_count}λͺ… + + 이 μ°Έμ—¬ν–ˆμ–΄μš”! + + )} From 26dc6ca00c877f3e24242f813a6da12c4726da6d Mon Sep 17 00:00:00 2001 From: 2NNS-V Date: Thu, 5 Sep 2024 23:54:51 +0900 Subject: [PATCH 05/10] =?UTF-8?q?feat:=20=ED=86=B5=EA=B3=84=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20API=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/AnalyticsPage.style.ts | 26 +++++++++- src/pages/AnalyticsPage.tsx | 83 +++++++++++++++++++++----------- 2 files changed, 80 insertions(+), 29 deletions(-) diff --git a/src/pages/AnalyticsPage.style.ts b/src/pages/AnalyticsPage.style.ts index 3b6536d..5773bc5 100644 --- a/src/pages/AnalyticsPage.style.ts +++ b/src/pages/AnalyticsPage.style.ts @@ -20,8 +20,32 @@ export const Main = styled.div``; export const Content = styled.div` margin: 20px; + gap: 10px; `; export const MiddleSection = styled.div` - flex-grow: 0.8; + flex-grow: 1; + border-bottom: 2px solid #0000001f; +`; + +export const TableContainer = styled.div` + display: flex; + flex-direction: column; + gap: 16px; + margin: 10px; +`; + +export const Card = styled.div` + padding: 16px; +`; + +export const Rank = styled.div` + font-weight: bold; + height: 30px; + display: flex; + align-items: center; +`; + +export const Type = styled.div` + color: #333; `; diff --git a/src/pages/AnalyticsPage.tsx b/src/pages/AnalyticsPage.tsx index ceea5d4..5963c7b 100644 --- a/src/pages/AnalyticsPage.tsx +++ b/src/pages/AnalyticsPage.tsx @@ -5,18 +5,44 @@ import DropDown from "@/components/form/DropDown"; import { AppBar } from "@/components/navigation/AppBar"; import { Text } from "@/components/typography"; +import useAxios from "@/hooks/useAxios"; + import backIcon from "@/assets/back.svg"; -import { TitleContainer, TitleTop, Main, Content, MiddleSection } from "./AnalyticsPage.style"; +import { TitleContainer, TitleTop, Main, MiddleSection, TableContainer, Card, Rank, Type } from "./AnalyticsPage.style"; + +interface axiosProps { + top: Array<[number, string]>; +} export default function AnalyticsPage() { - const [selectedMajor, setSelectedMajor] = React.useState(""); + const [selectedMajor, setSelectedMajor] = React.useState("humanities"); const navigate = useNavigate(); const handleGoBack = () => { navigate("/"); }; + const { + data: allData, + loading, + error, + } = useAxios( + { + url: `/stats/top/mbti`, + method: "GET", + }, + [], + ); + + const { data: majorData } = useAxios( + { + url: `/stats/top/department?key=${selectedMajor}`, + method: "GET", + }, + [selectedMajor], + ); + return ( <> @@ -27,20 +53,21 @@ export default function AnalyticsPage() {
- - 1μœ„ - λ¬΄λŒ€λ₯Ό μ’‹μ•„ν•˜λŠ” μ—°μ£Όκ°€ν˜• - - - - 2μœ„ - 극락왕생을 μ›ν•˜λŠ” λΆ€μ²˜λ‹˜ν˜• - - - 3μœ„ - ν‹°μΉ­μ˜ λŒ€κ°€ ν˜„μš°μ§„ν˜• - + {loading && Loading...} + {error && Error: {error}} + + {allData && allData.top && ( + + {allData.top.map((value, index) => ( + + {index + 1}μœ„ + {value[0]} + + ))} + + )}
+ @@ -58,19 +85,19 @@ export default function AnalyticsPage() { μ–΄λ–€ μœ ν˜•μ΄ κ°€μž₯ λ§Žμ„κΉŒμš”?
- - 1μœ„ - λ¬΄λŒ€λ₯Ό μ’‹μ•„ν•˜λŠ” μ—°μ£Όκ°€ν˜• - - - - 2μœ„ - 극락왕생을 μ›ν•˜λŠ” λΆ€μ²˜λ‹˜ν˜• - - - 3μœ„ - ν‹°μΉ­μ˜ λŒ€κ°€ ν˜„μš°μ§„ν˜• - + {loading && Loading...} + {error && Error: {error}} + + {majorData && majorData.top && ( + + {majorData.top.map((value, index) => ( + + {index + 1}μœ„ + {value[0]} + + ))} + + )}
); From 508574d5afdcf140f4b54d0c505956bf71612904 Mon Sep 17 00:00:00 2001 From: 2NNS-V Date: Thu, 5 Sep 2024 23:58:00 +0900 Subject: [PATCH 06/10] =?UTF-8?q?refact:=20useAxios=20=ED=83=80=EC=9E=85?= =?UTF-8?q?=20=EB=AA=85=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useAxios.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hooks/useAxios.tsx b/src/hooks/useAxios.tsx index 6423085..5b45690 100644 --- a/src/hooks/useAxios.tsx +++ b/src/hooks/useAxios.tsx @@ -8,7 +8,10 @@ const instance = axios.create({ withCredentials: true, }); -export default function useAxios(config: AxiosRequestConfig, dependencies: any[] = []) { +export default function useAxios( + config: AxiosRequestConfig, + dependencies: ReadonlyArray = [], +) { const [data, setData] = React.useState(null); const [loading, setLoading] = React.useState(false); const [error, setError] = React.useState(null); From 88c663a80808db29f423abe723d4f8b5fb17927a Mon Sep 17 00:00:00 2001 From: 2NNS-V Date: Fri, 6 Sep 2024 00:29:43 +0900 Subject: [PATCH 07/10] =?UTF-8?q?fix:=20Axios=20=ED=83=80=EC=9E=85=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useAxios.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/hooks/useAxios.tsx b/src/hooks/useAxios.tsx index 5b45690..5a529e7 100644 --- a/src/hooks/useAxios.tsx +++ b/src/hooks/useAxios.tsx @@ -8,10 +8,7 @@ const instance = axios.create({ withCredentials: true, }); -export default function useAxios( - config: AxiosRequestConfig, - dependencies: ReadonlyArray = [], -) { +export default function useAxios(config: AxiosRequestConfig, dependencies: ReadonlyArray = []) { const [data, setData] = React.useState(null); const [loading, setLoading] = React.useState(false); const [error, setError] = React.useState(null); From 767c3d0a3102f30fd1d15a60e6a8dc2e320c3693 Mon Sep 17 00:00:00 2001 From: 2NNS-V Date: Fri, 6 Sep 2024 00:30:49 +0900 Subject: [PATCH 08/10] =?UTF-8?q?fix:=20renderData=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20=EB=B0=8F=20=ED=83=80=EC=9E=85=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/AnalyticsPage.tsx | 69 +++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/src/pages/AnalyticsPage.tsx b/src/pages/AnalyticsPage.tsx index 5963c7b..83eeb47 100644 --- a/src/pages/AnalyticsPage.tsx +++ b/src/pages/AnalyticsPage.tsx @@ -15,6 +15,31 @@ interface axiosProps { top: Array<[number, string]>; } +const renderData = (data: axiosProps | null, loading: boolean, error: AxiosError | Error | null) => { + if (loading) return Loading...; + if (error) return Error: {error}; + if (data?.top.length == 0) { + return ( + + 데이터가 μ‘΄μž¬ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. + + ); + } + if (data && data.top) { + return ( + + {data.top.map((value, index) => ( + + {index + 1}μœ„ + {value[0]} + + ))} + + ); + } + return null; +}; + export default function AnalyticsPage() { const [selectedMajor, setSelectedMajor] = React.useState("humanities"); const navigate = useNavigate(); @@ -25,9 +50,9 @@ export default function AnalyticsPage() { const { data: allData, - loading, - error, - } = useAxios( + loading: allDataLoading, + error: allDataError, + } = useAxios( { url: `/stats/top/mbti`, method: "GET", @@ -35,7 +60,11 @@ export default function AnalyticsPage() { [], ); - const { data: majorData } = useAxios( + const { + data: majorData, + loading: majorDataLoading, + error: majorDataError, + } = useAxios( { url: `/stats/top/department?key=${selectedMajor}`, method: "GET", @@ -52,21 +81,7 @@ export default function AnalyticsPage() { μ–΄λ–€ μœ ν˜•μ΄ κ°€μž₯ λ§Žμ„κΉŒμš”? -
- {loading && Loading...} - {error && Error: {error}} - - {allData && allData.top && ( - - {allData.top.map((value, index) => ( - - {index + 1}μœ„ - {value[0]} - - ))} - - )} -
+
{renderData(allData, allDataLoading, allDataError)}
@@ -84,21 +99,7 @@ export default function AnalyticsPage() { μ–΄λ–€ μœ ν˜•μ΄ κ°€μž₯ λ§Žμ„κΉŒμš”? -
- {loading && Loading...} - {error && Error: {error}} - - {majorData && majorData.top && ( - - {majorData.top.map((value, index) => ( - - {index + 1}μœ„ - {value[0]} - - ))} - - )} -
+
{renderData(majorData, majorDataLoading, majorDataError)}
); } From 1a68b0afde7e79742c9ecff573875a827bf38d51 Mon Sep 17 00:00:00 2001 From: 2NNS-V Date: Fri, 6 Sep 2024 00:35:40 +0900 Subject: [PATCH 09/10] =?UTF-8?q?fix:=20=EC=88=9C=EC=9C=84=20=EB=B0=9B?= =?UTF-8?q?=EC=95=84=EC=98=A4=EB=8A=94=20=ED=95=A8=EC=88=98=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20=EB=B0=8F=20=ED=83=80=EC=9E=85=20=EC=A7=80=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/AnalyticsPage.tsx | 69 +++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/src/pages/AnalyticsPage.tsx b/src/pages/AnalyticsPage.tsx index 5963c7b..94dfbc4 100644 --- a/src/pages/AnalyticsPage.tsx +++ b/src/pages/AnalyticsPage.tsx @@ -15,6 +15,31 @@ interface axiosProps { top: Array<[number, string]>; } +const renderData = (data: axiosProps | null, loading: boolean, error: any) => { + if (loading) return Loading...; + if (error) return Error: {error.message}; + if (data?.top.length == 0) { + return ( + + 데이터가 μ‘΄μž¬ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. + + ); + } + if (data && data.top) { + return ( + + {data.top.map((value, index) => ( + + {index + 1}μœ„ + {value[0]} + + ))} + + ); + } + return null; +}; + export default function AnalyticsPage() { const [selectedMajor, setSelectedMajor] = React.useState("humanities"); const navigate = useNavigate(); @@ -25,9 +50,9 @@ export default function AnalyticsPage() { const { data: allData, - loading, - error, - } = useAxios( + loading: allDataLoading, + error: allDataError, + } = useAxios( { url: `/stats/top/mbti`, method: "GET", @@ -35,7 +60,11 @@ export default function AnalyticsPage() { [], ); - const { data: majorData } = useAxios( + const { + data: majorData, + loading: majorDataLoading, + error: majorDataError, + } = useAxios( { url: `/stats/top/department?key=${selectedMajor}`, method: "GET", @@ -52,21 +81,7 @@ export default function AnalyticsPage() { μ–΄λ–€ μœ ν˜•μ΄ κ°€μž₯ λ§Žμ„κΉŒμš”? -
- {loading && Loading...} - {error && Error: {error}} - - {allData && allData.top && ( - - {allData.top.map((value, index) => ( - - {index + 1}μœ„ - {value[0]} - - ))} - - )} -
+
{renderData(allData, allDataLoading, allDataError)}
@@ -84,21 +99,7 @@ export default function AnalyticsPage() { μ–΄λ–€ μœ ν˜•μ΄ κ°€μž₯ λ§Žμ„κΉŒμš”? -
- {loading && Loading...} - {error && Error: {error}} - - {majorData && majorData.top && ( - - {majorData.top.map((value, index) => ( - - {index + 1}μœ„ - {value[0]} - - ))} - - )} -
+
{renderData(majorData, majorDataLoading, majorDataError)}
); } From a347d623c8e9784c2e8bfecdc29fe9e3f0b1a24f Mon Sep 17 00:00:00 2001 From: 2NNS-V Date: Fri, 6 Sep 2024 00:36:07 +0900 Subject: [PATCH 10/10] =?UTF-8?q?refact:=20import=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useAxios.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/hooks/useAxios.tsx b/src/hooks/useAxios.tsx index 5a529e7..4760bd6 100644 --- a/src/hooks/useAxios.tsx +++ b/src/hooks/useAxios.tsx @@ -1,7 +1,6 @@ import React from "react"; -import axios from "axios"; -import { AxiosRequestConfig } from "axios"; +import axios, { AxiosRequestConfig } from "axios"; const instance = axios.create({ baseURL: "https://api.dongbti.com",