mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-21 21:25:11 +00:00
docs(examples): fix error handling example (#18434)
This commit is contained in:
parent
2af6cc84db
commit
625022cf28
@ -0,0 +1,3 @@
|
||||
<template>
|
||||
<h1>Index</h1>
|
||||
</template>
|
@ -0,0 +1,3 @@
|
||||
<template>
|
||||
<h1>Other</h1>
|
||||
</template>
|
@ -1,8 +1,7 @@
|
||||
import { getQuery, defineMiddleware } from 'h3'
|
||||
import { getQuery, defineEventHandler } from 'h3'
|
||||
|
||||
export default defineMiddleware((req, res, next) => {
|
||||
if ('api' in getQuery(req)) {
|
||||
export default defineEventHandler((event) => {
|
||||
if ('api' in getQuery(event)) {
|
||||
throw new Error('Server middleware error')
|
||||
}
|
||||
next()
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user