Skip to content

Commit

Permalink
feat: allow changing the path in extendRoute
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Feb 16, 2023
1 parent c032ff6 commit a9d0c77
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/core/extendRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,19 @@ export class EditableTreeNode {
return this.node.path
}

/**
* Override the path of the route. You must ensure `params` match with the existing path.
*/
set path(path: string) {
if (!path.startsWith('/')) {
warn(
`Only absolute paths are supported. Make sure that "${path}" starts with a slash "/".`
)
return
}
this.node.value.addEditOverride({ path })
}

/**
* Alias of the route.
*/
Expand Down

0 comments on commit a9d0c77

Please sign in to comment.