import { defineStore } from "pinia";
export const useUserStore = defineStore('user', {
  state: () => ({
    userInfo: null,
    authToken: ""
  }),
  actions: {
    setUseInfo(data) {
      this.userInfo = data;
      this.authToken = data.token;
      sessionStorage.setItem("authToken", data.token);
    },
    clearUserInfo () {
      this.userInfo = null;
      this.authToken = "";
      sessionStorage.removeItem("authToken");
    }
  }
})