mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
refactor: read selected locale inside session store
This commit is contained in:
1 parent
5e8d3f275d
commit
a7039714aa
3 files changed
+6
-4
No files matched your search
@@ -35,7 +35,7 @@ const reset = async () => {
|
||||
return
|
||||
}
|
||||
|
||||
await sessionStore.createSession(selectedLocale)
|
||||
await sessionStore.createSession()
|
||||
} catch (error) {
|
||||
console.error('Failed to reset quest:', error)
|
||||
toast.error(t('game.reset_failed'))
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useToast } from 'vue-toastification'
|
||||
import { computed } from 'vue'
|
||||
import { useSession } from '../../store/session'
|
||||
|
||||
const { t, locale } = useI18n()
|
||||
const { t } = useI18n()
|
||||
|
||||
const toast = useToast()
|
||||
const sessionStore = useSession()
|
||||
@@ -13,7 +13,7 @@ const showCover = computed(() => sessionStore.session === null)
|
||||
|
||||
const startSession = async () => {
|
||||
try {
|
||||
await sessionStore.createSession(locale.value)
|
||||
await sessionStore.createSession()
|
||||
} catch (err: any) {
|
||||
console.error(err)
|
||||
toast.error(err.message)
|
||||
|
||||
@@ -10,6 +10,7 @@ import Socket from '../utils/socket'
|
||||
import SocketTerminal from '../utils/terminal'
|
||||
import type { Session } from '../types'
|
||||
import { trpc } from '../utils/trpc'
|
||||
import { i18n } from '../i18n'
|
||||
|
||||
const socket = new Socket()
|
||||
const term = new SocketTerminal()
|
||||
@@ -65,7 +66,8 @@ export const useSession = defineStore('session', {
|
||||
)
|
||||
term.focus()
|
||||
},
|
||||
async createSession(locale: QuestLocale) {
|
||||
async createSession() {
|
||||
const locale = i18n.global.locale.value
|
||||
const session = await trpc.session.createSession.mutate({
|
||||
questId: this.questId,
|
||||
locale,
|
||||
|
||||
Reference in new issue
Block a user