Skip to content

Commit

Permalink
fix(kit): clone middleware when adding to app
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Mar 15, 2024
1 parent 4be430e commit 5be9253
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/kit/src/pages.ts
Expand Up @@ -53,12 +53,12 @@ export function addRouteMiddleware (input: NuxtMiddleware | NuxtMiddleware[], op
if (find >= 0) {
if (app.middleware[find].path === middleware.path) { continue }
if (options.override === true) {
app.middleware[find] = middleware
app.middleware[find] = { ...middleware }
} else {
logger.warn(`'${middleware.name}' middleware already exists at '${app.middleware[find].path}'. You can set \`override: true\` to replace it.`)
}
} else {
app.middleware.push(middleware)
app.middleware.push({ ...middleware })
}
}
})
Expand Down

0 comments on commit 5be9253

Please sign in to comment.