Is there a way to make the first parameter in my list of routes optional? I want the parameter to change a header in my api calls if it's present in the url, but everything else should stay the same.
Instead of creating two sets of routes to handle this, can I list the first parameter as optional and define my routes only once?
Each route can contain an :environment
param at the beginning:
/:environment/:event_identifier/register/pages/:page_uuid
or it can be:
/:event_identifier/register/pages/:page_uuid
All other parts of the route will remain unchanged.
let routes = [{
path: '/:event_identifier/register/pages/:page_uuid',
name: 'ContentPage',
component: ContentPage,
meta: {
requiresAuth: true,
},
}, {
path: '/:event_identifier/register/:pagenum',
name: 'Register',
component: Register,
meta: {
requiresAuth: true,
},
}, {
path: '/:event_identifier',
name: 'Login',
component: Login,
children: [{
path: '/:event_identifier/:registration_uuid/:pagenum',
name: 'editRegistration',
component: Login,
}]
}]