/*
 * @Description:: 请补充填写
 * @Version: 请配置版本号
 * @Author: 舟舟
 * @Date: 2022-06-25 22:53:51
 * @LastEditors: 舟舟
 * @LastEditTime: 2022-07-16 09:53:26
 * @FilePath: /ouicai_web_framework_vite_ep/src/stores/adminInfo.ts
 */
import { defineStore } from 'pinia'
import { ADMIN_INFO } from '/@/stores/constant/cacheKey'
import { AdminInfo } from '/@/stores/interface'

export const useAdminInfo = defineStore('adminInfo', {
    state: (): AdminInfo => {
        return {
            id: 0,
            accountName: '',
            avatar: '',
            lastLoginTime: '',
            token: '',
            refreshToken: '',
        }
    },
    actions: {
        removeToken() {
            this.token = ''
            this.refreshToken = ''
        },
    },
    persist: {
        key: ADMIN_INFO,
    },
})
