mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-16 21:58:19 +00:00
chore: update length error message
This commit is contained in:
parent
747845a2a9
commit
9e88b29bac
@ -2,11 +2,17 @@
|
||||
definePageMeta({
|
||||
middleware: [defineNuxtRouteMiddleware((to) => {
|
||||
const globalMiddleware: string[] | undefined = to.meta.globalMiddleware
|
||||
if (!globalMiddleware?.length) { return createError('Missing to.meta.globalMiddleware') }
|
||||
if (!globalMiddleware?.length) {
|
||||
return createError('Missing to.meta.globalMiddleware')
|
||||
}
|
||||
|
||||
if (globalMiddleware.length !== 4) { return createError('Missing to.meta.globalMiddleware') }
|
||||
if (globalMiddleware.length !== 4) {
|
||||
return createError(`Missmatch to.meta.globalMiddleware length, expected 4 entries and found ${globalMiddleware.length}`)
|
||||
}
|
||||
|
||||
if (!globalMiddleware.every((m, idx) => (idx === 0 && m === '01.a.global') || (idx === 1 && m === '01.b.global') || (idx === 2 && m === 'a.global') || (idx === 3 && m === 'b.global'))) { return createError('Missmatch to.meta.globalMiddleware sorting order') }
|
||||
if (!globalMiddleware.every((m, idx) => (idx === 0 && m === '01.a.global') || (idx === 1 && m === '01.b.global') || (idx === 2 && m === 'a.global') || (idx === 3 && m === 'b.global'))) {
|
||||
return createError('Missmatch to.meta.globalMiddleware sorting order')
|
||||
}
|
||||
})]
|
||||
})
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user