FlowPacs/yudao-ui-admin-uniapp/utils/auth.js

23 lines
550 B
JavaScript
Raw Normal View History

2022-08-03 11:52:35 +08:00
const AccessTokenKey = 'ACCESS_TOKEN'
const RefreshTokenKey = 'REFRESH_TOKEN'
// ========== Token 相关 ==========
export function getAccessToken() {
return uni.getStorageSync(AccessTokenKey)
}
export function getRefreshToken() {
return uni.getStorageSync(RefreshTokenKey)
}
export function setToken(token) {
uni.setStorageSync(AccessTokenKey, token.accessToken)
uni.setStorageSync(RefreshTokenKey, token.refreshToken)
}
export function removeToken() {
uni.removeStorageSync(AccessTokenKey)
uni.removeStorageSync(RefreshTokenKey)
}