Does a isRoute()
composable exist ... ?
#1820
-
Just a quick query, I've scanned the documentation for the potential of something like: isRoute("hello-world") && router.push("hello-world") Where we can lightly check if a route exists without the error when one isn't defined before routing ... does such a composable / utility exist? Maybe by a different name? |
Beta Was this translation helpful? Give feedback.
Answered by
posva
May 2, 2023
Replies: 1 comment 1 reply
-
It doesn't exist but you can create your own by scanning the array of routes FYI that wouldn't be a composable, it just be a function. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
posva
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It doesn't exist but you can create your own by scanning the array of routes
router.getRoutes()
which is already flattened or withrouter.resolve()
.FYI that wouldn't be a composable, it just be a function.