Files
umed/web/server/middleware/admin-spa.ts
T
2026-07-09 14:35:32 +08:00

13 lines
404 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { isAdminSpaRoute, serveAdminSpa } from '~/server/utils/admin-spa'
/**
* 管理后台为 Vue SPA(history 模式)。
* 刷新 /admin/xxx 时须回退 index.html,否则 Nuxt 会当成官网路由返回 404。
*/
export default defineEventHandler(async (event) => {
const pathname = getRequestURL(event).pathname
if (!isAdminSpaRoute(pathname)) return
return serveAdminSpa(event)
})