Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
fix: respect redirect within routes array
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Sep 22, 2022
1 parent 6b7abce commit 8706b67
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/nuxt/src/pages/utils.ts
Expand Up @@ -243,7 +243,7 @@ export function normalizeRoutes (routes: NuxtPage[], metaImports: Set<string> =
children: route.children ? normalizeRoutes(route.children, metaImports).routes : [],
meta: route.meta ? `{...(${metaImportName} || {}), ...${JSON.stringify(route.meta)}}` : metaImportName,
alias: aliasCode,
redirect: `${metaImportName}?.redirect || undefined`,
redirect: route.redirect ? JSON.stringify(route.redirect) : `${metaImportName}?.redirect || undefined`,
component: genDynamicImport(file, { interopDefault: true })
}
}))
Expand Down
3 changes: 2 additions & 1 deletion packages/schema/src/types/hooks.ts
Expand Up @@ -43,7 +43,8 @@ export type NuxtPage = {
path: string
file: string
meta?: Record<string, any>
alias?: string[]
alias?: string[] | string
redirect?: string
children?: NuxtPage[]
}

Expand Down

0 comments on commit 8706b67

Please sign in to comment.