list hook

This commit is contained in:
2026-07-22 19:44:11 -05:00
parent 087d94cbd9
commit 69da029156
@@ -0,0 +1,17 @@
import {useQuery} from "@tanstack/react-query";
import {Job} from "../types.ts";
const useJobList = () => useQuery({
queryKey: ['job'],
queryFn: async (): Promise<Job[]> => {
const response = await fetch(
import.meta.env.VITE_API_URL + '/jobs',
)
if (!response.ok) throw new Error('Failed to fetch jobs ' + response.statusText)
return await response.json()
},
});
export default useJobList;