import { TOKEN_KEY } from '@/enums/cacheEnums'
import { resetRouter } from '@/router'
import useTabsStore from '@/stores/modules/multipleTabs'
import useUserStore from '@/stores/modules/user'
import cache from './cache'
import {
    ElMessage,
    ElMessageBox,
    ElNotification,
    ElLoading,
    type ElMessageBoxOptions
} from 'element-plus'

export function getToken() {
    return cache.get(TOKEN_KEY)
}

export function getBrandId() {
    return cache.get("brandId")
}

export function getHouseId() {
    return cache.get("houseId")
}

export function getUserId() {
    return cache.get("userId")
}
export function clearAuthInfo() {
    // const userStore = useUserStore()
    // const tabsStore = useTabsStore()
    // userStore.resetState()
    // tabsStore.$reset()
    // cache.remove(TOKEN_KEY)
    // cache.remove("brandId")
    // cache.remove("houseId")
    // cache.remove("userId")
    // resetRouter()
    console.warn("***clearAuthInfo***")
    // 确认窗体
    ElMessageBox.confirm("已经在其他地方登录", '温馨提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
    }).then(() => {
        window.close();
    })
}
