无人机管理后台前端(已迁走)
张含笑
2025-08-05 c832bf2e80ac465e71b7a1c1f7a59d4252030989
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
33
34
35
36
37
38
39
40
import Cookies from 'js-cookie';
 
const TokenKey = 'saber3-access-token';
const RefreshTokenKey = 'saber3-refresh-token';
const SessionId = 'JSESSIONID';
const UserId = 'b-user-id';
 
export function getToken() {
    return Cookies.get(TokenKey, {
        path: '/'
    });
}
 
export function setToken(token) {
    return Cookies.set(TokenKey, token, {
        expires: 7,
        path: '/'
    });
}
 
export function getRefreshToken() {
    return Cookies.get(RefreshTokenKey);
}
 
export function setRefreshToken(token) {
    return Cookies.set(RefreshTokenKey, token, {
        expires: 7,
        path: '/'
    });
}
 
export function removeToken() {
    Cookies.remove(SessionId);
    Cookies.remove(UserId);
    return Cookies.remove(TokenKey);
}
 
export function removeRefreshToken() {
    return Cookies.remove(RefreshTokenKey);
}