first commit
This commit is contained in:
16
src/utils/session.js
Normal file
16
src/utils/session.js
Normal file
@@ -0,0 +1,16 @@
|
||||
/** 对齐 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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user