Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

router.ts

21 lines532 Bytes

1import { createRouter, RouterHistory } from "@tanstack/react-router";
2​
3import { observeNavigationBlockers } from "./lib/navigationBlockers";
4import { routeTree } from "./routeTree.gen";
5​
6export function getRouter(history: RouterHistory) {
7 return createRouter({
8 routeTree,
9 history: observeNavigationBlockers(history),
10 context: {},
11 defaultPreload: "intent",
12 });
14​
15export type AppRouter = ReturnType<typeof getRouter>;
16​
17declare module "@tanstack/react-router" {
18 interface Register {
19 router: AppRouter;
20 }