17 lines
462 B
JavaScript
17 lines
462 B
JavaScript
|
|
/** 对齐 tyc-webview-v2 登录成功后的本地存储字段 */
|
||
|
|
export function saveAuthSession(payload) {
|
||
|
|
uni.setStorageSync('token', payload.accessToken)
|
||
|
|
uni.setStorageSync('refreshAfter', String(payload.refreshAfter))
|
||
|
|
uni.setStorageSync('accessExpire', String(payload.accessExpire))
|
||
|
|
}
|
||
|
|
|
||
|
|
export function hasToken() {
|
||
|
|
try {
|
||
|
|
const t = uni.getStorageSync('token')
|
||
|
|
return typeof t === 'string' && t.length > 0
|
||
|
|
}
|
||
|
|
catch {
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
}
|