diff --git a/services/frontend/src/hooks/index.ts b/services/frontend/src/hooks/index.ts new file mode 100644 index 0000000..221fa0f --- /dev/null +++ b/services/frontend/src/hooks/index.ts @@ -0,0 +1 @@ +export { default as useProject } from "./useProject"; \ No newline at end of file diff --git a/services/frontend/src/hooks/useProject.ts b/services/frontend/src/hooks/useProject.ts new file mode 100644 index 0000000..f5a81aa --- /dev/null +++ b/services/frontend/src/hooks/useProject.ts @@ -0,0 +1,17 @@ +import axios from "axios" + +const useProject = (uuid?: string) => { + return useQuery(["project", uuid], async () => { + if (!uuid) { + return; + } + const { data } = await axios.get(`${API_SERVER_URL}/projects/${uuid}/`, { + headers: { + "Content-Type": "application/json" + } + }) + return data + }) +} + +export default useProject; \ No newline at end of file