Complete to "Client Side Routing"
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
|
||||
import { Route as rootRoute } from './routes/__root'
|
||||
import { Route as IndexImport } from './routes/index'
|
||||
import { Route as ContactsContractIdImport } from './routes/contacts.$contractId'
|
||||
|
||||
// Create/Update Routes
|
||||
|
||||
@@ -21,6 +22,12 @@ const IndexRoute = IndexImport.update({
|
||||
getParentRoute: () => rootRoute,
|
||||
} as any)
|
||||
|
||||
const ContactsContractIdRoute = ContactsContractIdImport.update({
|
||||
id: '/contacts/$contractId',
|
||||
path: '/contacts/$contractId',
|
||||
getParentRoute: () => rootRoute,
|
||||
} as any)
|
||||
|
||||
// Populate the FileRoutesByPath interface
|
||||
|
||||
declare module '@tanstack/react-router' {
|
||||
@@ -32,6 +39,13 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof IndexImport
|
||||
parentRoute: typeof rootRoute
|
||||
}
|
||||
'/contacts/$contractId': {
|
||||
id: '/contacts/$contractId'
|
||||
path: '/contacts/$contractId'
|
||||
fullPath: '/contacts/$contractId'
|
||||
preLoaderRoute: typeof ContactsContractIdImport
|
||||
parentRoute: typeof rootRoute
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,32 +53,37 @@ declare module '@tanstack/react-router' {
|
||||
|
||||
export interface FileRoutesByFullPath {
|
||||
'/': typeof IndexRoute
|
||||
'/contacts/$contractId': typeof ContactsContractIdRoute
|
||||
}
|
||||
|
||||
export interface FileRoutesByTo {
|
||||
'/': typeof IndexRoute
|
||||
'/contacts/$contractId': typeof ContactsContractIdRoute
|
||||
}
|
||||
|
||||
export interface FileRoutesById {
|
||||
__root__: typeof rootRoute
|
||||
'/': typeof IndexRoute
|
||||
'/contacts/$contractId': typeof ContactsContractIdRoute
|
||||
}
|
||||
|
||||
export interface FileRouteTypes {
|
||||
fileRoutesByFullPath: FileRoutesByFullPath
|
||||
fullPaths: '/'
|
||||
fullPaths: '/' | '/contacts/$contractId'
|
||||
fileRoutesByTo: FileRoutesByTo
|
||||
to: '/'
|
||||
id: '__root__' | '/'
|
||||
to: '/' | '/contacts/$contractId'
|
||||
id: '__root__' | '/' | '/contacts/$contractId'
|
||||
fileRoutesById: FileRoutesById
|
||||
}
|
||||
|
||||
export interface RootRouteChildren {
|
||||
IndexRoute: typeof IndexRoute
|
||||
ContactsContractIdRoute: typeof ContactsContractIdRoute
|
||||
}
|
||||
|
||||
const rootRouteChildren: RootRouteChildren = {
|
||||
IndexRoute: IndexRoute,
|
||||
ContactsContractIdRoute: ContactsContractIdRoute,
|
||||
}
|
||||
|
||||
export const routeTree = rootRoute
|
||||
@@ -77,11 +96,15 @@ export const routeTree = rootRoute
|
||||
"__root__": {
|
||||
"filePath": "__root.tsx",
|
||||
"children": [
|
||||
"/"
|
||||
"/",
|
||||
"/contacts/$contractId"
|
||||
]
|
||||
},
|
||||
"/": {
|
||||
"filePath": "index.tsx"
|
||||
},
|
||||
"/contacts/$contractId": {
|
||||
"filePath": "contacts.$contractId.tsx"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user