Client - minor refacto

This commit is contained in:
Sam
2022-06-29 16:27:00 +02:00
parent 0cc33faf97
commit 045559cfd8
5 changed files with 28 additions and 17 deletions

View File

@ -79,7 +79,6 @@
<script setup lang="ts">
import { ComputedRef, computed, ref, capitalize } from 'vue'
import { useI18n } from 'vue-i18n'
import UserPicture from '@/components/User/UserPicture.vue'
import { AUTH_USER_STORE, ROOT_STORE } from '@/store/constants'
@ -90,7 +89,6 @@
const emit = defineEmits(['menuInteraction'])
const { locale } = useI18n()
const store = useStore()
const authUser: ComputedRef<IAuthUserProfile> = computed(
@ -113,9 +111,10 @@
emit('menuInteraction', false)
}
function updateLanguage(option: IDropdownOption) {
locale.value = option.value.toString()
document.querySelector('html')?.setAttribute('lang', locale.value)
store.commit(ROOT_STORE.MUTATIONS.UPDATE_LANG, option.value)
store.dispatch(
ROOT_STORE.ACTIONS.UPDATE_APPLICATION_LANGUAGE,
option.value.toString()
)
}
function logout() {
store.dispatch(AUTH_USER_STORE.ACTIONS.LOGOUT)