13 lines
404 B
TypeScript
13 lines
404 B
TypeScript
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)
|
||
})
|