Implement filtering flights by aircraft

This commit is contained in:
april
2024-01-11 13:21:55 -06:00
parent b50d333677
commit 38d62770f6
4 changed files with 121 additions and 36 deletions

View File

@@ -11,3 +11,23 @@ export function useAircraft() {
return aircraft;
}
export function useFlights(filter: string = "", value: string = "") {
const client = useApi();
const flights = useQuery({
queryKey: ["flights-list"],
queryFn: async () =>
await client
.get(
`/flights/by-date?order=1${
filter !== "" && value !== ""
? `&filter=${filter}&value=${value}`
: ""
}`
)
.then((res) => res.data),
});
return flights;
}