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

Understanding Vue middleware pipelines

Dotun Jolaoso Software developer.

Recent posts:

A Guide To Cookies In Next Js

A guide to cookies in Next.js

Cookies are crucial to web development. This article will explore how to handle cookies in your Next.js applications.

Georgey V B
Apr 30, 2024 ⋅ 10 min read
Handling Dates In JavaScript With Tempo

Handling dates in JavaScript with Tempo

Use the Tempo library to format dates and times in JavaScript while accounting for time zones, daylight saying time, and date internationalization.

Amazing Enyichi Agu
Apr 30, 2024 ⋅ 8 min read
A Guide To Deno.cron

A guide to Deno.cron

This guide explores how to use the cron package in Deno, `Deno.cron`, to handle scheduling tasks with specific commands.

Rosario De Chiara
Apr 29, 2024 ⋅ 5 min read
Comparing Mutative Vs Immer Vs Reducers For Data Handling In React

Comparing React state tools: Mutative vs. Immer vs. reducers

Mutative processes data with better performance than both Immer and native reducers. Let’s compare these data handling options in React.

Rashedul Alam
Apr 26, 2024 ⋅ 7 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