add react-query
This commit is contained in:
10
frontend/src/services/api.ts
Normal file
10
frontend/src/services/api.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
export function getForm(id: number) {
|
||||
return useQuery({
|
||||
queryKey: ['form'],
|
||||
queryFn: () => (
|
||||
fetch(`http://localhost:8000/forms/${id}`).then((res) => res.json())
|
||||
),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user