const state = {
  fontSize: localStorage.getItem("fontSize") || 14,
  selectedIndex: sessionStorage.getItem("selectedIndex") || "",
  refreshFlag: 0,
  age: "",
}
const getters = {
  fontSize: (state) => state.fontSize,
  selectedIndex: (state) => state.selectedIndex,
  refreshFlag: (state) => state.refreshFlag,
  age: (state) => state.age,
}
const mutations = {
  setFontSize(state, fontSize) {
    state.fontSize = fontSize
  },
  setSelectedIndex(state, selectedIndex) {
    state.selectedIndex = selectedIndex
    sessionStorage.setItem("selectedIndex", selectedIndex)
  },
  removeSelectedIndex() {
    state.selectedIndex = ""
    sessionStorage.removeItem("selectedIndex")
  },
  setRefreshFlag(state, refreshFlag) {
    state.refreshFlag = refreshFlag
  },
  setAge(state, age) {
    state.age = age
  },
}
const actions = {}
export default {
  state,
  getters,
  mutations,
  actions,
}
