提交正式官网
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { requireAuth } from '~/server/utils/auth'
|
||||
import { fail, ok } from '~/server/utils/response'
|
||||
|
||||
/** 记录登录日志(当前仅接收并返回成功,避免前端报错) */
|
||||
export default defineEventHandler(async (event) => {
|
||||
const auth = requireAuth(event)
|
||||
if (!auth) {
|
||||
setResponseStatus(event, 401)
|
||||
return fail('未授权,请先登录', 401)
|
||||
}
|
||||
|
||||
await readBody(event).catch(() => null)
|
||||
return ok(null, '添加登录日志成功')
|
||||
})
|
||||
Reference in New Issue
Block a user