import { defineStore } from "pinia";
import { store } from "@/stores";
import socketApi from "@/socket/socketApi";
import http from "@/https/index";

export const useGiftStore = defineStore("gift", {
  persist: true,
  state: () => {
    return {
      threeInOneInfo: <any>{},
    };
  },
  actions: {
    getThreeInOneInfo() {
      http.getOneOfThree().then((res: any) => {
        if (res.code !== 0) return;
        this.threeInOneInfo = res.data;
      });
    },
  },
});

// Need to be used outside the setup
export const useGiftStoreWithOut = () => {
  return useGiftStore(store);
};
