add user privileges & add translations
This commit is contained in:
@@ -4,14 +4,35 @@ import App from './App.vue'
|
||||
import router from './router'
|
||||
import './style.css'
|
||||
import { useSettingsStore } from './stores/settings'
|
||||
import { useUserStore } from './stores/user'
|
||||
import { createI18n } from 'vue-i18n'
|
||||
import en from './locales/en.json'
|
||||
import ru from './locales/ru.json'
|
||||
|
||||
const i18n = createI18n({
|
||||
legacy: false,
|
||||
locale: 'en',
|
||||
fallbackLocale: 'en',
|
||||
messages: { en, ru }
|
||||
})
|
||||
|
||||
const app = createApp(App)
|
||||
const pinia = createPinia()
|
||||
app.use(pinia)
|
||||
app.use(router)
|
||||
app.use(i18n)
|
||||
|
||||
// Загружаем настройки до монтирования
|
||||
const settingsStore = useSettingsStore()
|
||||
settingsStore.loadSettings().then(() => {
|
||||
const userStore = useUserStore()
|
||||
|
||||
// Загружаем настройки и профиль
|
||||
Promise.all([
|
||||
settingsStore.loadSettings(),
|
||||
userStore.fetchProfile().catch(() => {})
|
||||
]).then(() => {
|
||||
// Устанавливаем язык из профиля, если есть
|
||||
if (userStore.language) {
|
||||
i18n.global.locale.value = userStore.language
|
||||
}
|
||||
app.mount('#app')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user