import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);
const api = {
  url: '/point/v1/api/admin',
};

const state = () => ({});
const mutations = {};

const actions = {
  async login({ commit }, payload) {
    try {
      const res = await this.$axios.$post(`${api.url}/login`, payload);
      if (res.errcode === 0) {
        sessionStorage.setItem('user', res.data);
      }
      return res;
    } catch (error) {
      return false;
    }
  },
};
export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
