mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
fix(kit): don't warn if middleware is added twice
This commit is contained in:
parent
196223c0fb
commit
08b656a047
@ -51,6 +51,7 @@ export function addRouteMiddleware (input: NuxtMiddleware | NuxtMiddleware[], op
|
|||||||
for (const middleware of middlewares) {
|
for (const middleware of middlewares) {
|
||||||
const find = app.middleware.findIndex(item => item.name === middleware.name)
|
const find = app.middleware.findIndex(item => item.name === middleware.name)
|
||||||
if (find >= 0) {
|
if (find >= 0) {
|
||||||
|
if (app.middleware[find].path === middleware.path) { continue }
|
||||||
if (options.override === true) {
|
if (options.override === true) {
|
||||||
app.middleware[find] = middleware
|
app.middleware[find] = middleware
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user