-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from LikeLion-KNU/hotfix
Hotfix
- Loading branch information
Showing
12 changed files
with
215 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { useEffect, useState } from "react"; | ||
|
||
import { top10Response } from "@/pages/AnalyticsPage"; | ||
|
||
import { api } from "@/config/axios"; | ||
|
||
export const useTop10 = () => { | ||
const [top10, setTop10] = useState<top10Response | null>(null); | ||
const [isPending, setIsPending] = useState<boolean>(false); | ||
const [isError, setIsError] = useState<boolean>(false); | ||
|
||
useEffect(() => { | ||
setIsPending(true); | ||
setIsError(false); | ||
|
||
api.get<top10Response>(`/stats/top/mbti`) | ||
.then((data) => { | ||
setTop10({ top: data.data.top }); | ||
console.log(data.data.top); | ||
}) | ||
.catch(() => { | ||
setIsError(true); | ||
}) | ||
.finally(() => { | ||
setIsPending(false); | ||
}); | ||
}, []); | ||
|
||
return { isPending, isError, top10 }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { useState, useEffect } from "react"; | ||
|
||
import { top10Response } from "@/pages/AnalyticsPage"; | ||
|
||
import { api } from "@/config/axios"; | ||
|
||
interface top10ByDepartmentProps { | ||
department: string; | ||
} | ||
|
||
export const useTop10ByDepartment = (department: top10ByDepartmentProps) => { | ||
const [top10ByDepartment, setTop10ByDepartment] = useState<top10Response | null>(null); | ||
const [isPending, setIsPending] = useState<boolean>(false); | ||
const [isError, setIsError] = useState<boolean>(false); | ||
|
||
useEffect(() => { | ||
setIsPending(true); | ||
setIsError(false); | ||
|
||
api.get<top10Response>(`/stats/top/department?key=${department.department}`) | ||
.then((data) => { | ||
setTop10ByDepartment({ top: data.data.top }); | ||
console.log(data.data.top); | ||
}) | ||
.catch(() => { | ||
setIsError(true); | ||
}) | ||
.finally(() => { | ||
setIsPending(false); | ||
}); | ||
}, [department.department]); | ||
|
||
return { isPending, isError, top10ByDepartment }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
import React from "react"; | ||
import ReactDOM from "react-dom/client"; | ||
|
||
import App from "./App.tsx"; | ||
|
||
ReactDOM.createRoot(document.getElementById("root")!).render( | ||
<React.StrictMode> | ||
<App /> | ||
</React.StrictMode>, | ||
); | ||
ReactDOM.createRoot(document.getElementById("root")!).render(<App />); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.