<script>
/**
 * This is the user store.
 */
import { createStore } from 'vuex';

export default createStore({
  state: {
    user: {
      authenticated: false,
      isAdmin: false,
      isSuperUser: false,
    }
  },
  mutations: {
    setUser(state, user) {
      state.user = user;
    },
  },
  actions: {
    login({ commit }, user) {
      commit('setUser', user);
    },
    logout({ commit }) {
      commit('setUser', null);
    },
  },
});
</script>