1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import {
    access_token,
    token_type,
    refresh_token,
    expires_in,
    license,
    scope,
    SuccessRedirect,
    FailRedirect
} from '@/config/status.config.js';
 
const SetStorage = (key) => (value) => uni.setStorageSync(key, value);
 
export const setAccessToken = SetStorage(access_token);
export const setTokenType = SetStorage(token_type);
export const setRefreshToken = SetStorage(refresh_token);
export const setScope = SetStorage(scope)
export const redirectHome = (path) => {
    uni.switchTab({
        url: path || SuccessRedirect
    })
}
 
export const redirectLogin = (path) => {
    uni.clearStorageSync();
    uni.reLaunch({
        url: path || FailRedirect
    })
}
 
// 获取用户状态
// export const getStates = (key) => uni.getStorageSync(key);