Where does next() come from? For me, even a simple code like this:
next()
export default function() { next(false) }
throws an error saying: "Reference error: next is not defined".
Sorry, that was taken just as an example from the article, but agree, can be confusing.
In docs you can find this example of middleware/auth.js
middleware/auth.js
export default function ({redirect, store}) { const isAuthenticated = store.state.auth.user ? true : false if (!isAuthenticated) { redirect({name: 'auth'}) } }
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Where does
next()
come from?For me, even a simple code like this:
throws an error saying: "Reference error: next is not defined".
Sorry, that was taken just as an example from the article, but agree, can be confusing.
In docs you can find this example of
middleware/auth.js