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 "./api";
import { useApi } from "./api";
import { useNavigate } from "@remix-run/react";
import { createContext, useContext, useEffect, useState } from "react";
@@ -37,6 +37,8 @@ function useProvideAuth() {
const navigate = useNavigate();
const client = useApi();
const handleUser = (rawUser: string | null) => {
if (rawUser) {
setUser(rawUser);