Implement filtering flights by aircraft
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user