import moment from "moment";
import { defineStore } from "pinia";
export const useUserStore = defineStore("user", {
  state: () => {
    return {
      isConnected: false, //连接状态
      chatInfo: {
        clientId: "",
        serviceId: "1805880457362661377",
      },
      count: 0,
    };
  },
  actions: {
    setCount(num: number) {
      this.count = num;
    },
    setChatInfo(res: any) {
      this.chatInfo = res;
    },
    connect() {
      // 连接成功后，将 isConnected 状态设置为 true
      this.isConnected = true;
    },
    disconnect() {
      // 断开连接或退出登录时，将 isConnected 状态设置为 false
      this.isConnected = false;
    },
  },
  persist: true,
});
