Whalebird-desktop-client-ma.../src/renderer/store/Settings.ts

45 lines
973 B
TypeScript
Raw Normal View History

import General, { GeneralState } from './Settings/General'
import Timeline, { TimelineState } from './Settings/Timeline'
2021-05-09 17:49:24 +02:00
import Filters, { FiltersModuleState } from './Settings/Filters'
import { Module, MutationTree } from 'vuex'
2019-04-14 16:11:24 +02:00
import { RootState } from '@/store'
export type SettingsState = {
2019-05-27 15:56:54 +02:00
accountID: string | null
}
const state = (): SettingsState => ({
accountID: null
})
export const MUTATION_TYPES = {
CHANGE_ACCOUNT_ID: 'changeAccountID'
}
const mutations: MutationTree<SettingsState> = {
2019-05-27 15:56:54 +02:00
[MUTATION_TYPES.CHANGE_ACCOUNT_ID]: (state, id: string) => {
state.accountID = id
}
}
type SettingsModule = {
2019-05-27 15:56:54 +02:00
General: GeneralState
Timeline: TimelineState
2021-05-09 17:49:24 +02:00
Filter: FiltersModuleState
}
export type SettingsModuleState = SettingsModule & SettingsState
2019-04-14 16:11:24 +02:00
const Settings: Module<SettingsState, RootState> = {
namespaced: true,
modules: {
General,
2021-05-08 13:59:59 +02:00
Timeline,
Filters
},
state: state,
mutations: mutations
}
export default Settings