The middleware Property

  • Type: String or Array
    • Items: String

Set the middleware for a specific page of the application.



  <h1>Secret page</h1>

export default {
  middleware: 'authenticated'


export default function ({ store, redirect }) {
  // If the user is not authenticated
  if (!store.state.authenticated) {
    return redirect('/login')

To learn more about the middleware, see the middleware guide.

Caught a mistake or want to contribute to the documentation? Edit this page on GitHub!