import { store } from "@/store";
import { appType } from "./types";
import { defineStore } from "pinia";
import { deviceDetection, storageLocal } from "@pureadmin/utils";

export const useLoginStore = defineStore({
  id: "pure-login",
  state: () => ({
    channel: localStorage.getItem(`CACHE_CHANNEL`)
  }),
  getters: {
    getChannel(state) {
      return state.channel;
    }
  },
  actions: {
    SET_CHANNEL(channel: string) {
      this.channel = channel;
      localStorage.setItem(`CACHE_CHANNEL`, channel);
    }
  }
});

export function useLoginStoreHook() {
  return useLoginStore(store);
}
