Files
automaker/apps/ui/src/utils/router.ts
SuperComboGamer 8d578558ff style: fix formatting with Prettier
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 20:31:57 -05:00

22 lines
644 B
TypeScript

import { createRouter, createMemoryHistory, createBrowserHistory } from '@tanstack/react-router';
import { routeTree } from '../routeTree.gen';
// Use browser history in web mode (for e2e tests and dev), memory history in Electron
const isElectron = typeof window !== 'undefined' && window.electronAPI !== undefined;
const history = isElectron
? createMemoryHistory({ initialEntries: [window.location.pathname || '/'] })
: createBrowserHistory();
export const router = createRouter({
routeTree,
defaultPendingMinMs: 0,
history,
});
declare module '@tanstack/react-router' {
interface Register {
router: typeof router;
}
}