@@ -7,12 +7,22 @@ if (window.ALIST.api) {
77 api = window . ALIST . api ;
88}
99
10+ let subfolder = ""
11+ if ( window . ALIST . subfolder ) {
12+ subfolder = window . ALIST . subfolder ;
13+ }
14+ if ( ! subfolder . endsWith ( "/" ) ) {
15+ subfolder = subfolder + "/" ;
16+ }
17+ if ( subfolder . startsWith ( "/" ) ) {
18+ subfolder = subfolder . substring ( 1 ) ;
19+ }
1020const instance = axios . create ( {
11- baseURL : api + "api/admin/" ,
21+ baseURL : api + subfolder + "api/admin/" ,
1222 // timeout: 5000
1323 headers : {
1424 "Content-Type" : "application/json;charset=utf-8" ,
15- // 'Authorization': localStorage.getItem("admin -token") || "",
25+ // 'Authorization': localStorage.getItem("alist_admin -token") || "",
1626 } ,
1727 withCredentials : false ,
1828} ) ;
@@ -47,7 +57,7 @@ instance.interceptors.response.use(
4757) ;
4858
4959instance . defaults . headers . common [ "Authorization" ] =
50- localStorage . getItem ( "admin -token" ) || "" ;
60+ localStorage . getItem ( "alist_admin -token" ) || "" ;
5161
5262export const changeToken = ( password : string ) => {
5363 let token = "" ;
@@ -56,7 +66,7 @@ export const changeToken = (password: string) => {
5666 }
5767 instance . defaults . headers . common [ "Authorization" ] = token ;
5868 publicR . defaults . headers . common [ "Authorization" ] = token ;
59- localStorage . setItem ( "admin -token" , token ) ;
69+ localStorage . setItem ( "alist_admin -token" , token ) ;
6070} ;
6171
6272export default instance ;
0 commit comments