getCookie 제거
This commit is contained in:
@@ -1,16 +1,14 @@
|
||||
import { execute, queryOne } from '../../../../utils/db'
|
||||
import { getClientIp } from '../../../../utils/ip'
|
||||
import { getCurrentUserEmail } from '../../../../utils/user'
|
||||
import { requireAuth } from '../../../../utils/session'
|
||||
|
||||
/**
|
||||
* 주간보고 제출
|
||||
* POST /api/report/weekly/[id]/submit
|
||||
*/
|
||||
export default defineEventHandler(async (event) => {
|
||||
const userId = getCookie(event, 'user_id')
|
||||
if (!userId) {
|
||||
throw createError({ statusCode: 401, message: '로그인이 필요합니다.' })
|
||||
}
|
||||
const userId = await requireAuth(event)
|
||||
|
||||
const reportId = getRouterParam(event, 'id')
|
||||
const clientIp = getClientIp(event)
|
||||
@@ -25,7 +23,7 @@ export default defineEventHandler(async (event) => {
|
||||
throw createError({ statusCode: 404, message: '보고서를 찾을 수 없습니다.' })
|
||||
}
|
||||
|
||||
if (report.author_id !== parseInt(userId)) {
|
||||
if (report.author_id !== userId) {
|
||||
throw createError({ statusCode: 403, message: '본인의 보고서만 제출할 수 있습니다.' })
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user