2019-06-21
2160
#vue
Dotun Jolaoso
3291
Jun 21, 2019 ⋅ 7 min read

Understanding Vue middleware pipelines

Dotun Jolaoso Software developer.

Recent posts:

Integrating Django Templates With React For Dynamic Webpages

Integrating Django templates with React for dynamic webpages

Create a dynamic demo blog site using Django and React to demonstrate Django’s server-side functionalities and React’s interactive UI.

Kayode Adeniyi
Apr 18, 2024 ⋅ 7 min read
Using Aoi Js To Build A Bot For Discord

Using aoi.js to build a bot on Discord

Explore how the aoi.js library makes it easy to create Discord bots with useful functionalities for frontend applications.

Rahul Padalkar
Apr 17, 2024 ⋅ 9 min read
Web Components Adoption Guide: Overview, Examples, And Alternatives

Web Components adoption guide: Overview, examples, and alternatives

Evaluate Web Components, a set of standards that allow you to create custom HTML tags for more reusable, manageable code.

Elijah Asaolu
Apr 16, 2024 ⋅ 11 min read
Using Aws Lambda And Aws Cloudfront To Optimize Image Handling

Using AWS Lambda and CloudFront to optimize image handling

Leverage services like AWS Lambda, CloudFront, and S3 to handle images more effectively, optimizing performance and providing a better UX.

Nitish Sharma
Apr 12, 2024 ⋅ 12 min read
View all posts

11 Replies to "Understanding Vue middleware pipelines"

  1. Interesting pattern as a first check, but since you’ll be making authenticated API requests to the backend to fetch data for these protected routes, which could fail if they’re not logged in or don’t have appropriate permissions, it seems redundant to also have a front-end middleware checking against the local VueX store. The redirects or error message display could be wrapped into an ApiClient class instead when the front-end gets an unauthorized error?

  2. Hello Dotun,
    Thanks for the a the blog, it was very insightful. Is there any way to apply middleware to all children routes instead of defining middleware to each route??

  3. Hello,

    Unfortunately, next code is not working:

    return middleware[0]({
    …context,
    next: middlewarePipeline(context, middleware, 1)
    })

    middleware[0] is not a function.

  4. How to pass more variable to middleware. Something like this

    meta: {
    middleware: [
    role(‘admin’)
    ]
    }

    And then I can check the user can enter or not a page via role

Leave a Reply