feat. GR_VISUAL_03 컴포넌트 제작

This commit is contained in:
clkim
2025-09-19 14:43:21 +09:00
parent 792111f47b
commit 81bcca8e23
14 changed files with 277 additions and 154 deletions

View File

@@ -0,0 +1,35 @@
import { getHeader, getRequestHost } from 'h3'
import { useRequestEvent } from 'nuxt/app'
/**
* 게임 도메인을 가져오는 컴포저블 함수
* 서버와 클라이언트 환경에서 모두 동작
* @returns 게임 도메인 문자열
*/
export const useGetGameDomain = (): string => {
try {
if (import.meta.client) {
const host = window.location.host || ''
return host.split(':')[0]
}
const event = useRequestEvent()
if (!event) {
return ''
}
// 미들웨어에서 설정한 gameDomain가 있다면 우선 사용
if (event.context.gameDomain) {
return event.context.gameDomain
}
const host =
(getHeader(event, 'host') || getRequestHost(event)).toString() || ''
const cleanHost = host.split(':')[0]
return cleanHost || ''
} catch (error) {
console.error('useGetGameDomain error:', error)
return ''
}
}