import { defineStore } from "pinia";
import axios from "axios";
import windowConfig from "@/window";

export const useMessageStore = defineStore("message", {
  state: () => ({
    messageCount: 0,
  }),
  actions: {
    fetchMessageCount() {
      axios
        .post(windowConfig.baseUrl + "/api/message/getMesCount", {})
        .then((res) => {
          this.messageCount = res.data.count || 0;
        })
        .catch(() => {});
    },
  },
});
