Static GitHub Issues

[2130] Validate several pages with similar routes

prev: Setting Up Nuxt With Nginx
next: I get TypeError: Cannot assign to read only property 'message' of object '' when performing mutations on a state property.

Hi! I want to add several pages with similar routes. A page should be displayed that suits the conditions in asyncData or validate.

Example:

# _foo.vue - only digits
export default {
  validate ({ params }) {
    return /^\d+$/.test(params.foo)
  }
}
# _bar.vue - only something else
export default {
  asyncData ({ params, error }) {
    return checkParams(params)
      .catch((e) => {
        # go to check next route
      })
  }
}
# _other.vue - for other params
export default {
}

Of course, I can make a general check in one file. But is it possible to implement it in several pages? Can this be seen as a task for the future?

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c1887">#c1887</a>)</em></sub></div>