import { TOKEN_KEY } from '/@/enums/cacheEnum'

export function getToken() {
    return getAuthCache(TOKEN_KEY)
}

export function getAuthCache(key: string): string | null {
    try {
        const value = uni.getStorageSync(key)
        if (value) {
            return value
        }
    } catch (e) {}

    return null
}

export function setAuthCache(key: string, value: string) {
    try {
        uni.setStorageSync(key, value)
    } catch (e) {}
}

export function clearAuthCache() {
    try {
        uni.clearStorageSync()
    } catch (e) {}
}
