Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 08b656a

Browse files
committed
fix(kit): don't warn if middleware is added twice
1 parent 196223c commit 08b656a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

packages/kit/src/pages.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export function addRouteMiddleware (input: NuxtMiddleware | NuxtMiddleware[], op
5151
for (const middleware of middlewares) {
5252
const find = app.middleware.findIndex(item => item.name === middleware.name)
5353
if (find >= 0) {
54+
if (app.middleware[find].path === middleware.path) { continue }
5455
if (options.override === true) {
5556
app.middleware[find] = middleware
5657
} else {

0 commit comments

Comments
 (0)