import { createStore } from "vuex";
import { request } from "../assets/helpers.js";

export default createStore({
	state: {
		userInfo: null,
	},
	mutations: {
		setUserInfo(state, userInfo) {
			state.userInfo = userInfo;
		}
	},
	actions: {
		async updateUserInfo({ commit }) {
			const userInfo = await request("GET", "/userinfo");
			commit("setUserInfo", userInfo);
		},
	}
});
