Client - init workouts timeline
This commit is contained in:
@ -7,6 +7,7 @@ export enum RootGetters {
|
||||
APP_LOADING = 'APP_LOADING',
|
||||
ERROR_MESSAGES = 'ERROR_MESSAGES',
|
||||
LANGUAGE = 'LANGUAGE',
|
||||
LOCALE = 'LOCALE', // date-fns
|
||||
}
|
||||
|
||||
export enum RootMutations {
|
||||
|
@ -16,4 +16,7 @@ export const getters: GetterTree<IRootState, IRootState> & IRootGetters = {
|
||||
[ROOT_STORE.GETTERS.LANGUAGE]: (state: IRootState) => {
|
||||
return state.language
|
||||
},
|
||||
[ROOT_STORE.GETTERS.LOCALE]: (state: IRootState) => {
|
||||
return state.locale
|
||||
},
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ import { MutationTree } from 'vuex'
|
||||
import { ROOT_STORE } from '@/store/constants'
|
||||
import { IRootState, TRootMutations } from '@/store/modules/root/types'
|
||||
import { IAppConfig } from '@/types/application'
|
||||
import { localeFromLanguage } from '@/utils/locales'
|
||||
|
||||
export const mutations: MutationTree<IRootState> & TRootMutations = {
|
||||
[ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES](state: IRootState) {
|
||||
@ -28,5 +29,6 @@ export const mutations: MutationTree<IRootState> & TRootMutations = {
|
||||
},
|
||||
[ROOT_STORE.MUTATIONS.UPDATE_LANG](state: IRootState, language: string) {
|
||||
state.language = language
|
||||
state.locale = localeFromLanguage[language]
|
||||
},
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
import { enUS } from 'date-fns/locale'
|
||||
|
||||
import { IRootState } from '@/store/modules/root/types'
|
||||
import { IApplication } from '@/types/application'
|
||||
|
||||
export const state: IRootState = {
|
||||
root: true,
|
||||
language: 'en',
|
||||
locale: enUS,
|
||||
errorMessages: null,
|
||||
application: <IApplication>{},
|
||||
appLoading: false,
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { Locale } from 'date-fns'
|
||||
import {
|
||||
ActionContext,
|
||||
CommitOptions,
|
||||
@ -11,6 +12,7 @@ import { IAppConfig, IApplication } from '@/types/application'
|
||||
export interface IRootState {
|
||||
root: boolean
|
||||
language: string
|
||||
locale: Locale
|
||||
errorMessages: string | string[] | null
|
||||
application: IApplication
|
||||
appLoading: boolean
|
||||
@ -32,6 +34,8 @@ export interface IRootGetters {
|
||||
): string | string[] | null
|
||||
|
||||
[ROOT_STORE.GETTERS.LANGUAGE](state: IRootState): string
|
||||
|
||||
[ROOT_STORE.GETTERS.LOCALE](state: IRootState): Locale
|
||||
}
|
||||
|
||||
export type TRootMutations<S = IRootState> = {
|
||||
|
Reference in New Issue
Block a user