提交正式官网
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { requireAuth } from '~/server/utils/auth'
|
||||
import { listPageSeo } from '~/server/utils/page-seo'
|
||||
import { fail, ok } from '~/server/utils/response'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const auth = requireAuth(event)
|
||||
if (!auth) {
|
||||
setResponseStatus(event, 401)
|
||||
return fail('未授权,请先登录', 401)
|
||||
}
|
||||
|
||||
const queryParams = getQuery(event)
|
||||
const locale = String(queryParams.locale || '')
|
||||
const keyword = String(queryParams.keyword || '')
|
||||
|
||||
const list = await listPageSeo({
|
||||
locale: locale === 'en' || locale === 'zh' ? locale : undefined,
|
||||
keyword: keyword || undefined,
|
||||
})
|
||||
|
||||
return ok(list)
|
||||
})
|
||||
Reference in New Issue
Block a user