import {defineStore} from "pinia";
import storage from "@/utils/storage";
import {useConfigStore} from "@/store/useConfigStore";


export const useUserStore = defineStore({
  id: 'user',
  state: () => ({
    token: null,
  }),
  getters: {},
  actions: {
    _init() {
      this.checkLogin()
    },
    checkLogin() {
      let token = storage.getKey('LOGIN_TEACHER_TOKEN')
      if (token) {
        this.token = token
      }
    },
    login() {
      const configStore = useConfigStore()
      let mac = configStore.getMac()
      console.log('login mac', mac)
    },
    logout() {
      this.token = null
    },
    // getMachineInfo() {
    //   this.mac = '123'
    // },
  }
})
