import Store from 'herculex';
import { userInfoList } from '../../utils/constants';

export default new Store({
  connectGlobal: true,
  state: {
    userInfoList: [],
  },
  getters: {
    list: (state, getters, global) => {
      const { userInfo } = global;
      const _list = userInfoList.concat();
      _list.forEach((item) => {
        Object.keys(userInfo).forEach((el) => {
          if (item.key === el) {
            item.value = userInfo[el];
          }
        });
      });
      return _list;
    },
  },
  actions: {
    async init() {
      //
    },
  },
});
