const getDefaultState = () => {
  return {
    curPath: null,
    navBarFixed: false,
    showLoginDialog: null,
    navbarColor: 'rgba(0, 0, 0, 0.25)', //默认navbar颜色
  }
}

const state = getDefaultState()

const mutations = {
  RESET_STATE: (state) => {
    Object.assign(state, getDefaultState())
  },
  SET_NAV_BAR: (state, path) => {
    state.curPath = path
  },
  SET_NAVBAR_FIXED: (state, isFixed) => {
    state.navBarFixed = isFixed
  },
  OPEN_LOGIN_DIALOG: (state, showLoginDialog) => {
    state.showLoginDialog = showLoginDialog
  },
  CHANGE_NAV_COLOR: (state, color) => {
    state.navbarColor = color
  },
}

export default {
  namespaced: true,
  state,
  mutations,
}
