35 lines
1.0 KiB
TypeScript
Raw Normal View History

2021-08-11 18:33:02 +02:00
import { MutationTree } from 'vuex'
2021-08-11 22:21:26 +02:00
2021-08-11 18:33:02 +02:00
import { ROOT_STORE } from '@/store/constants'
import { IRootState, TRootMutations } from '@/store/modules/root/types'
2021-08-21 18:36:44 +02:00
import { IAppConfig } from '@/types/application'
2021-09-20 12:18:40 +02:00
import { localeFromLanguage } from '@/utils/locales'
2021-08-11 18:33:02 +02:00
export const mutations: MutationTree<IRootState> & TRootMutations = {
[ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES](state: IRootState) {
state.errorMessages = null
2021-08-11 21:12:20 +02:00
},
[ROOT_STORE.MUTATIONS.SET_ERROR_MESSAGES](
2021-08-11 21:12:20 +02:00
state: IRootState,
errorMessages: string
2021-08-11 21:12:20 +02:00
) {
state.errorMessages = errorMessages
2021-08-11 21:12:20 +02:00
},
2021-08-15 12:30:39 +02:00
[ROOT_STORE.MUTATIONS.UPDATE_APPLICATION_CONFIG](
state: IRootState,
config: IAppConfig
) {
state.application.config = config
},
[ROOT_STORE.MUTATIONS.UPDATE_APPLICATION_LOADING](
state: IRootState,
loading: boolean
) {
state.appLoading = loading
},
2021-08-11 18:33:02 +02:00
[ROOT_STORE.MUTATIONS.UPDATE_LANG](state: IRootState, language: string) {
state.language = language
2021-09-20 12:18:40 +02:00
state.locale = localeFromLanguage[language]
2021-08-11 18:33:02 +02:00
},
}