getCookie 제거
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { query, execute } from '../../../../utils/db'
|
||||
import { requireAuth } from '../../../../utils/session'
|
||||
|
||||
const ADMIN_EMAIL = 'coziny@gmail.com'
|
||||
|
||||
@@ -7,10 +8,7 @@ const ADMIN_EMAIL = 'coziny@gmail.com'
|
||||
* DELETE /api/report/weekly/[id]/delete
|
||||
*/
|
||||
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')
|
||||
if (!reportId) {
|
||||
@@ -33,7 +31,7 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
|
||||
// 권한 체크: 본인 또는 관리자만 삭제 가능
|
||||
if (report[0].author_id !== parseInt(userId) && !isAdmin) {
|
||||
if (report[0].author_id !== userId && !isAdmin) {
|
||||
throw createError({ statusCode: 403, message: '삭제 권한이 없습니다.' })
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user