You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That's just a suggestion. Since we don't have any example of a middleware inside a template but we use an undocumented api folder which is just a discrepant addition in my opinion. Why not use middleware as Nuxt intended? api/people.ts can be placed in middleware folder and rewritten as such:
Sorry, I reviewed the PR before seeing this.
Like I said, I think this is a poor use of middleware and will confuse people.
Middleware in ts works exactly the same as without, so we don't need to exercise it.
Perhaps if we give typings for the arguments of the middleware function, it will be more useful.
Still, I think we can do much better than the example.
As for the api folder, I thought it was a decent way of abstracting away axios (someone's api might be firebase-client, etc.) and the correct place to typecheck the returned values and handle network errors, returning the store or other caller a parsed data promise.
That's just a suggestion. Since we don't have any example of a middleware inside a template but we use an undocumented
api
folder which is just a discrepant addition in my opinion. Why not usemiddleware
as Nuxt intended?api/people.ts
can be placed in middleware folder and rewritten as such:and in the store actions:
and in
nuxt.config.js
module.exports objectthis way we can showcase how middleware function can be used in the template that might be beneficial for a lot of users
The text was updated successfully, but these errors were encountered: