getCookie 제거
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { query, execute, queryOne } from '../../../../utils/db'
|
||||
import { requireAuth } from '../../../../utils/session'
|
||||
|
||||
const ADMIN_EMAIL = 'coziny@gmail.com'
|
||||
|
||||
@@ -7,10 +8,7 @@ const ADMIN_EMAIL = 'coziny@gmail.com'
|
||||
* PUT /api/report/weekly/[id]/update
|
||||
*/
|
||||
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 = getHeader(event, 'x-forwarded-for') || 'unknown'
|
||||
@@ -28,7 +26,7 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
|
||||
// 관리자가 아니면 본인 보고서만 수정 가능
|
||||
if (!isAdmin && report.author_id !== parseInt(userId)) {
|
||||
if (!isAdmin && report.author_id !== userId) {
|
||||
throw createError({ statusCode: 403, message: '본인의 보고서만 수정할 수 있습니다.' })
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user