File tree Expand file tree Collapse file tree 3 files changed +18
-16
lines changed
image-tool/src/business/chengdu/hook Expand file tree Collapse file tree 3 files changed +18
-16
lines changed Original file line number Diff line number Diff line change @@ -3,15 +3,17 @@ import Cookies from 'js-cookie';
3
3
window . Cookies = Cookies ;
4
4
5
5
let hostname = document . location . hostname || document . location . host ;
6
- let dot = hostname . indexOf ( '.' ) ;
7
- let parentHost = isIp ( hostname ) ? hostname : hostname . substring ( dot + 1 ) ;
6
+ // let dot = hostname.indexOf('.');
7
+ // let parentHost = isIp(hostname) ? hostname : hostname.substring(dot + 1);
8
8
9
9
export default function useToken ( ) {
10
- let token = Cookies . get ( `${ parentHost } token` ) ;
10
+ let token = Cookies . get ( `${ hostname } token` ) ;
11
11
token = token ? `Bearer ${ token } ` : '' ;
12
12
return token ;
13
13
}
14
14
15
- function isIp ( str :string = '' ) {
16
- return / ( ( 2 5 [ 0 - 5 ] | 2 [ 0 - 4 ] \d | ( ( 1 \d { 2 } ) | ( [ 1 - 9 ] ? \d ) ) ) \. ) { 3 } ( 2 5 [ 0 - 5 ] | 2 [ 0 - 4 ] \d | ( ( 1 \d { 2 } ) | ( [ 1 - 9 ] ? \d ) ) ) / . test ( str ) ;
15
+ function isIp ( str : string = '' ) {
16
+ return / ( ( 2 5 [ 0 - 5 ] | 2 [ 0 - 4 ] \d | ( ( 1 \d { 2 } ) | ( [ 1 - 9 ] ? \d ) ) ) \. ) { 3 } ( 2 5 [ 0 - 5 ] | 2 [ 0 - 4 ] \d | ( ( 1 \d { 2 } ) | ( [ 1 - 9 ] ? \d ) ) ) / . test (
17
+ str ,
18
+ ) ;
17
19
}
Original file line number Diff line number Diff line change @@ -3,17 +3,17 @@ import Cookies from 'js-cookie';
3
3
window . Cookies = Cookies ;
4
4
5
5
let hostname = document . location . hostname || document . location . host ;
6
- let dot = hostname . indexOf ( '.' ) ;
7
- let parentHost = isIp ( hostname ) ? hostname : hostname . substring ( dot + 1 ) ;
6
+ // let dot = hostname.indexOf('.');
7
+ // let parentHost = isIp(hostname) ? hostname : hostname.substring(dot + 1);
8
8
9
9
export default function useToken ( ) {
10
- let token = Cookies . get ( `${ parentHost } token` ) ;
10
+ let token = Cookies . get ( `${ hostname } token` ) ;
11
11
token = token ? `Bearer ${ token } ` : '' ;
12
12
return token ;
13
13
}
14
14
15
-
16
-
17
- function isIp ( str : string = '' ) {
18
- return / ( ( 2 5 [ 0 - 5 ] | 2 [ 0 - 4 ] \d | ( ( 1 \d { 2 } ) | ( [ 1 - 9 ] ? \d ) ) ) \. ) { 3 } ( 2 5 [ 0 - 5 ] | 2 [ 0 - 4 ] \d | ( ( 1 \d { 2 } ) | ( [ 1 - 9 ] ? \d ) ) ) / . test ( str ) ;
19
- }
15
+ function isIp ( str : string = '' ) {
16
+ return / ( ( 2 5 [ 0 - 5 ] | 2 [ 0 - 4 ] \d | ( ( 1 \d { 2 } ) | ( [ 1 - 9 ] ? \d ) ) ) \. ) { 3 } ( 2 5 [ 0 - 5 ] | 2 [ 0 - 4 ] \d | ( ( 1 \d { 2 } ) | ( [ 1 - 9 ] ? \d ) ) ) / . test (
17
+ str ,
18
+ ) ;
19
+ }
Original file line number Diff line number Diff line change @@ -3,11 +3,11 @@ import Cookies from 'js-cookie';
3
3
window . Cookies = Cookies ;
4
4
5
5
let hostname = document . location . hostname || document . location . host ;
6
- let dot = hostname . indexOf ( '.' ) ;
7
- let parentHost = isIp ( hostname ) ? hostname : hostname . substring ( dot + 1 ) ;
6
+ // let dot = hostname.indexOf('.');
7
+ // let parentHost = isIp(hostname) ? hostname : hostname.substring(dot + 1);
8
8
9
9
export default function useToken ( ) {
10
- let token = Cookies . get ( `${ parentHost } token` ) ;
10
+ let token = Cookies . get ( `${ hostname } token` ) ;
11
11
token = token ? `Bearer ${ token } ` : '' ;
12
12
return token ;
13
13
}
You can’t perform that action at this time.
0 commit comments