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

@@ -22,14 +22,11 @@ export default defineEventHandler(async event => {
const host =
(getHeader(event, 'host') || getRequestHost(event)).toString() || ''
const baseDomain = process.env.BASE_DOMAIN || '.onstove.com'
const isGameAliasExtractable = host.includes(baseDomain)
const isGameDomainExtractable = host.includes(baseDomain)
if (isGameAliasExtractable) {
const gameAlias = host.split('.')[0]
if (gameAlias && gameAlias !== 'www') {
event.context.gameAlias = gameAlias
}
if (isGameDomainExtractable) {
const cleanHost = host.split(':')[0]
event.context.gameDomain = cleanHost
}
// gameData를 직접 가져와서 context에 저장 (API 호출 없이)
@@ -52,7 +49,7 @@ export default defineEventHandler(async event => {
const langCode = pathSegments[0] || 'ko'
const queryParams: Record<string, string> = {
game_alias: event.context.gameAlias || '',
game_domain: event.context.gameDomain || '',
lang_code: langCode,
}
@@ -63,7 +60,7 @@ export default defineEventHandler(async event => {
// 타입 단언을 사용하여 response의 타입 오류를 해결
const res = response as { code?: number; value?: unknown }
if (res?.code === 0 && 'value' in res) {
if (res?.code === 0 && res && typeof res === 'object' && 'value' in res) {
event.context.gameData = res.value
}
} catch (error) {