import {SHOP_ID, TOKEN_KEY} from '@/enums/cacheEnums'
import cache from './cache'

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 getShopId() {
    if (cache.get(SHOP_ID))
        return JSON.parse(<string>cache.get(SHOP_ID)).value
    return ''
}

export function clearAuthInfo() {
    cache.remove(TOKEN_KEY)
    window.localStorage.removeItem("like_admin_token")
    window.localStorage.removeItem("like_admin_brandId")
    window.localStorage.removeItem("like_admin_userId")
    window.localStorage.removeItem("like_admin_houseId")
    cache.remove(SHOP_ID)
    // 确认窗体
    /*ElMessageBox.confirm("已经在其他地方登录", '温馨提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
    }).then(() => {
        window.close();
    })*/
}
