mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-16 02:44:51 +00:00
12 lines
265 B
TypeScript
12 lines
265 B
TypeScript
import { defineNuxtRouteMiddleware } from '#app'
|
|
|
|
export default defineNuxtRouteMiddleware(async (to) => {
|
|
if (!to.meta?.validate) { return }
|
|
|
|
const result = await Promise.resolve(to.meta.validate(to))
|
|
if (result === true) {
|
|
return
|
|
}
|
|
return result
|
|
})
|