2024-09-17 12:11:39 +08:00
|
|
|
import { ChakraProvider } from "@chakra-ui/react"
|
|
|
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"
|
|
|
|
import { RouterProvider, createRouter } from "@tanstack/react-router"
|
|
|
|
import ReactDOM from "react-dom/client"
|
|
|
|
import { routeTree } from "./routeTree.gen"
|
|
|
|
import { OpenAPI } from "./client"
|
|
|
|
import theme from "./theme"
|
|
|
|
|
|
|
|
OpenAPI.BASE = import.meta.env.VITE_API_URL
|
|
|
|
OpenAPI.TOKEN = async () => {
|
|
|
|
return localStorage.getItem("access_token") || ""
|
|
|
|
}
|
|
|
|
|
|
|
|
const queryClient = new QueryClient()
|
|
|
|
|
|
|
|
const router = createRouter({ routeTree })
|
|
|
|
declare module "@tanstack/react-router" {
|
|
|
|
interface Register {
|
|
|
|
router: typeof router
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ReactDOM.createRoot(document.getElementById("root")!).render(
|
2024-10-03 10:28:33 +08:00
|
|
|
|
2024-09-17 12:11:39 +08:00
|
|
|
<ChakraProvider theme={theme}>
|
|
|
|
<QueryClientProvider client={queryClient}>
|
|
|
|
<RouterProvider router={router} />
|
|
|
|
</QueryClientProvider>
|
|
|
|
</ChakraProvider>
|
2024-10-03 10:28:33 +08:00
|
|
|
|
2024-09-17 12:11:39 +08:00
|
|
|
)
|