April 2017
Intermediate to advanced
454 pages
12h 51m
English
This is the ultimate redirect. You can access the route the user is trying to access and decide where you want to redirect him (you can't cancel the redirection though):
...{ path: '/air', component: Air },{ path: '/bags', name: 'bags', component: Bags },{ path: '/super-shirt/:size', component: SuperShirt },{ path: '/shirt/:size?', component: Shirt},{ path: '/shirts/:size?', redirect: to => { const { hash, params, query } = to if (query.colour === 'transparent') { return { path: '/air', query: null } } if (hash === '#prada') { return { name: 'bags', hash: '' } } if (params.size > 10) { return '/super-shirt/:size' } else { return '/shirt/:size?' } }}
Read now
Unlock full access