Move api client to a hook and allow .env api url config

This commit is contained in:
april
2024-01-05 11:42:05 -06:00
parent 05fefd40b1
commit 02c45bbc63
9 changed files with 99 additions and 50 deletions

View File

@@ -1,4 +1,4 @@
import { client } from "@/util/api";
import { useApi } from "@/util/api";
import { FlightConciseSchema } from "@/util/types";
import {
NavLink,
@@ -22,6 +22,8 @@ import {
import { UseQueryResult, useQuery } from "@tanstack/react-query";
function useFlights() {
const client = useApi();
const flights = useQuery({
queryKey: ["flights-list"],
queryFn: async () =>