bugfix: set ui language according to game language

This commit is contained in:
Settel 2022-09-30 08:43:40 +02:00
parent 376a9f5642
commit dce33d2088

View File

@ -1,5 +1,5 @@
import { navigateTo } from "#app"
import { useUserinfoStore, Userinfo } from "@/stores/UserinfoStore" import { useUserinfoStore, Userinfo } from "@/stores/UserinfoStore"
import useI18n from "./useI18n"
import { $fetch } from 'ohmyfetch' import { $fetch } from 'ohmyfetch'
export type AllowRole = '' | 'player' | 'gamemaster' | 'admin' export type AllowRole = '' | 'player' | 'gamemaster' | 'admin'
@ -19,6 +19,7 @@ export default (): useAuth => {
try { try {
const userInfo = await $fetch('/api/userinfo') as Userinfo const userInfo = await $fetch('/api/userinfo') as Userinfo
user.setUserInfo(userInfo) user.setUserInfo(userInfo)
useI18n({}).setLang(userInfo.lang)
if (allowRoles.indexOf(userInfo.role) >= 0 ) { if (allowRoles.indexOf(userInfo.role) >= 0 ) {
return return
} }