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

33 lines
739 B
TypeScript
Raw Normal View History

2020-01-23 06:16:40 +13:00
import { getterTree, mutationTree, actionTree } from 'typed-vuex'
2020-01-24 04:23:26 +13:00
import { get, set } from '~/utils/localstorage'
2020-01-23 06:16:40 +13:00
export const namespaced = true
2020-01-24 04:23:26 +13:00
export const state = () => ({
side: get<boolean>('side', false),
tab: get<string>('tab', 'chat'),
about: false,
about_page: '',
})
2020-01-23 06:16:40 +13:00
export const getters = getterTree(state, {})
export const mutations = mutationTree(state, {
setTab(state, tab: string) {
state.tab = tab
2020-01-24 04:23:26 +13:00
set('tab', tab)
2020-01-23 06:16:40 +13:00
},
setAbout(state, page: string) {
state.about_page = page
},
toggleAbout(state) {
state.about = !state.about
},
toggleSide(state) {
state.side = !state.side
2020-01-24 04:23:26 +13:00
set('side', state.side)
2020-01-23 06:16:40 +13:00
},
})
export const actions = actionTree({ state, getters, mutations }, {})