mirror of https://github.com/ctk-hq/ctk
feat: created `useProject` hook
parent
caca17ca40
commit
99f935f81b
@ -0,0 +1 @@
|
|||||||
|
export { default as useProject } from "./useProject";
|
||||||
@ -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;
|
||||||
Loading…
Reference in New Issue