import { client } from "@/util/api"; import { Flight } from "@/util/types"; import { NavLink, Text, Button, ScrollArea, Stack } from "@mantine/core"; import { Link, useLocation } from "@remix-run/react"; import { IconPlus } from "@tabler/icons-react"; import { useQuery } from "@tanstack/react-query"; export function FlightsList() { const flights = useQuery({ queryKey: ["flights-list"], queryFn: () => client.get(`/flights`).then((res) => res.data), }); const location = useLocation(); const page = location.pathname.split("/")[3]; return ( {flights.data ? ( flights.data.map((flight: Flight, index: number) => ( )) ) : ( No Flights )} ); } export function MobileFlightsList() { const flights = useQuery({ queryKey: ["flights-list"], queryFn: () => client.get(`/flights`).then((res) => res.data), }); const location = useLocation(); const page = location.pathname.split("/")[3]; return ( {flights.data ? ( flights.data.map((flight: Flight, index: number) => ( )) ) : ( No Flights )} ); } export default { FlightsList, MobileFlightsList };