Closed bpatram closed 6 years ago
Hi @bpatram !
Good catch, it seems I didn't think of removing a route. I think we can add a remove()
method to the highway object for easier access. Something like this:
highway.route({
name: 'home',
path: '/',
action () { /* Display home */ }
})
highway.remove({ name: 'home' })
Leveraging the store.find()
method we can target the route to remove using the current url.
// Define a profile route
highway.route({
name: 'profile'
path: '/user/:name',
action () { /* Display profile */ }
})
// Let's say the current path is /user/rascarlito
highway.remove({ path: window.location.pathname })
Sounds good?
Check #44
Is it possible to unregister a route? It seems trivial to remove it from the Router but difficult to remove from the highway
store
since there are no public methods/variables to mutate its store data.