refactor. 게임 데이터 초기화 개선
- LanguageSwitcher.vue에서 언어 전환 시 게임 데이터 즉시 갱신 로직 개선 - init-game-data.server.ts 파일 추가로 서버 사이드에서 게임 데이터 초기화 로직 구현 - app.vue에서 불필요한 게임 데이터 초기화 로직 제거
This commit is contained in:
11
app/app.vue
11
app/app.vue
@@ -1,13 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { useNuxtApp } from 'nuxt/app'
|
||||
|
||||
const nuxtApp = useNuxtApp()
|
||||
const { locale } = useI18n()
|
||||
const gameDataStore = useGameDataStore()
|
||||
const modalStore = useModalStore()
|
||||
const scrollStore = useScrollStore()
|
||||
|
||||
const { setGameData } = gameDataStore
|
||||
const { confirm, alert } = modalStore
|
||||
const {
|
||||
gameName,
|
||||
@@ -95,13 +91,6 @@ const setupGameHead = () => {
|
||||
}
|
||||
}
|
||||
|
||||
if (import.meta.server) {
|
||||
const gameData = nuxtApp.ssrContext?.event?.context?.gameData
|
||||
if (gameData) {
|
||||
setGameData(gameData)
|
||||
}
|
||||
}
|
||||
|
||||
setupGameHead()
|
||||
|
||||
let rafId: number | null = null
|
||||
|
||||
Reference in New Issue
Block a user