This commit is contained in:
2025-12-12 17:10:54 +07:00
commit 2c244b77fb
53 changed files with 13115 additions and 0 deletions

28
src/router.tsx Normal file
View File

@@ -0,0 +1,28 @@
import { createRouter } from '@tanstack/react-router'
import { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query'
import * as TanstackQuery from './integrations/tanstack-query/root-provider'
// Import the generated route tree
import { routeTree } from './routeTree.gen'
// Create a new router instance
export const getRouter = () => {
const rqContext = TanstackQuery.getContext()
const router = createRouter({
routeTree,
context: { ...rqContext },
defaultPreload: 'intent',
Wrap: (props: { children: React.ReactNode }) => {
return (
<TanstackQuery.Provider {...rqContext}>
{props.children}
</TanstackQuery.Provider>
)
},
})
setupRouterSsrQueryIntegration({ router, queryClient: rqContext.queryClient })
return router
}