feat: cards, attributes and modules
This commit is contained in:
26
src/pages/CardsPage/hooks/useProjects.tsx
Normal file
26
src/pages/CardsPage/hooks/useProjects.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { type FullProjectSchema, ProjectService } from "../../../client";
|
||||
|
||||
|
||||
const useProjects = () => {
|
||||
const [projects, setProjects] = useState<FullProjectSchema[]>([]);
|
||||
|
||||
const refetchProjects = () => {
|
||||
ProjectService.getProjects()
|
||||
.then(data => {
|
||||
setProjects(data.projects);
|
||||
})
|
||||
.catch(e => console.log(e));
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
refetchProjects();
|
||||
}, []);
|
||||
|
||||
return {
|
||||
projects,
|
||||
refetchProjects,
|
||||
};
|
||||
};
|
||||
|
||||
export default useProjects;
|
||||
Reference in New Issue
Block a user