K
K
Kirill Ushakov2018-06-20 17:33:50
Vue.js
Kirill Ushakov, 2018-06-20 17:33:50

Parameter validation followed by redirection in Vue.js?

There is a router

{ path: '/category/:id', component: Article, props: true }

In the component Article, you need to check idfor the type: number - ok, we work further; line - redirect to 404.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shvets, 2018-06-20
@Bellicus

What prevents in component in beforeMount to check id and redirect?
In general, there is https://router.vuejs.org/ru/guide/advanced/navigat...
or middleware in Nuxt for this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question