import { createStore } from 'vuex';

export default createStore({
  state: {
    token: undefined as string | undefined,
  },
  getters: {
    getToken: (state) => state.token,
  },
  mutations: {
    setToken: (state, token) => {
      state.token = token;
    },
    clearToken: (state) => {
      state.token = undefined;
    },
  },
  actions: {
    setToken: (context) => {
      context.commit('setToken');
    },
    clearToken: (context) => {
      context.commit('clearToken');
    },
  },
  modules: {
  },
});
