getCookie 제거

This commit is contained in:
2026-01-10 21:59:11 +09:00
parent ef7914d5c6
commit 1b8cd8577e
30 changed files with 195 additions and 145 deletions

View File

@@ -1,16 +1,17 @@
import type { H3Event } from 'h3'
import { queryOne } from './db'
import { getAuthenticatedUserId } from './session'
/**
* 현재 로그인한 사용자의 이메일 조회
*/
export async function getCurrentUserEmail(event: H3Event): Promise<string | null> {
const userId = getCookie(event, 'user_id')
const userId = await getAuthenticatedUserId(event)
if (!userId) return null
const user = await queryOne<{ employee_email: string }>(`
SELECT employee_email FROM wr_employee_info WHERE employee_id = $1
`, [parseInt(userId)])
`, [userId])
return user?.employee_email || null
}