Archived
2
0
This repository has been archived on 2024-06-24. You can view files and clone it, but cannot push or open issues or pull requests.
neko-custom/client/src/store/client.ts
2020-02-04 15:37:56 +00:00

33 lines
739 B
TypeScript

import { getterTree, mutationTree, actionTree } from 'typed-vuex'
import { get, set } from '~/utils/localstorage'
export const namespaced = true
export const state = () => ({
side: get<boolean>('side', false),
tab: get<string>('tab', 'chat'),
about: false,
about_page: '',
})
export const getters = getterTree(state, {})
export const mutations = mutationTree(state, {
setTab(state, tab: string) {
state.tab = tab
set('tab', tab)
},
setAbout(state, page: string) {
state.about_page = page
},
toggleAbout(state) {
state.about = !state.about
},
toggleSide(state) {
state.side = !state.side
set('side', state.side)
},
})
export const actions = actionTree({ state, getters, mutations }, {})