//引入pinia
import { defineStore } from 'pinia'
import { ref } from 'vue'
const userInfoStore = defineStore(
  'userInfo',
  () => {
    //定义token
    const token = ref<string>('')
    //定义用户信息
    const userInfo = ref<any>({
      account: ''
    })
    //保存token信息
    const saveToken = (val: string) => {
      token.value = val
    }

    //保存用户信息
    const saveUserInfo = (val: any) => {
      //重置用户信息
      userInfo.value = val
    }

    return { token, saveToken, userInfo, saveUserInfo }
  },
  { persist: true }
)

export { userInfoStore }
