import { getterTree, mutationTree } from 'typed-vuex' import { get, set } from '~/utils/localstorage' export const namespaced = true export const state = () => { return { scroll: get('scroll', 10), scroll_invert: get('scroll_invert', true), autoplay: get('autoplay', true), ignore_emotes: get('ignore_emotes', false), chat_sound: get('chat_sound', true), } } export const getters = getterTree(state, {}) export const mutations = mutationTree(state, { setScroll(state, scroll: number) { state.scroll = scroll set('scroll', scroll) }, setInvert(state, value: boolean) { state.scroll_invert = value set('scroll_invert', value) }, setAutoplay(state, value: boolean) { state.autoplay = value set('autoplay', value) }, setIgnore(state, value: boolean) { state.ignore_emotes = value set('ignore_emotes', value) }, setSound(state, value: boolean) { state.chat_sound = value set('chat_sound', value) }, })