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

@@ -21,7 +21,7 @@ import { HourInput, ZeroHourInput } from "@/ui/form/hour-input";
import { ZeroIntInput } from "@/ui/form/int-input";
import ListInput from "@/ui/form/list-input";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { client } from "@/util/api";
import { useApi } from "@/util/api";
import { useNavigate } from "@remix-run/react";
import { useAuth } from "@/util/auth";
import { AxiosError } from "axios";
@@ -80,6 +80,8 @@ export default function NewFlight() {
const navigate = useNavigate();
const queryClient = useQueryClient();
const client = useApi();
const { clearUser } = useAuth();
const createFlight = useMutation({