How to validate route parameter in Nuxt? How to validate route parameter in Nuxt? vue.js vue.js

How to validate route parameter in Nuxt?


Your validate method must return a boolean:

async validate({ params, store}) {    // await operations   return true // if the params are valid   return false // will stop Nuxt.js to render the route and display the error page}

see official documentation: https://nuxtjs.org/api/pages-validate#the-validate-method


async validate({ params, store }) {    return await store.dispatch(types.VALIDATE_PARAMS_ASYNC, params.id)}