File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 27
27
"echarts-for-react" : " ^3.0.2" ,
28
28
"framer-motion" : " ^9.0.2" ,
29
29
"html-react-parser" : " ^3.0.16" ,
30
+ "js-cookie" : " ^3.0.5" ,
30
31
"minimist" : " ^1.2.8" ,
31
32
"query-string" : " ^8.1.0" ,
32
33
"react" : " ^18.2.0" ,
Original file line number Diff line number Diff line change 1
1
import axios from "axios" ;
2
+ // eslint-disable-next-line import/no-extraneous-dependencies
3
+ import Cookies from "js-cookie" ;
2
4
import { TAxiosWrapper } from "../types" ;
3
5
4
- const TOKEN = "clerk-db-jwt " ;
6
+ const TOKEN = "__session " ;
5
7
const PATH_PREFIX = "/api/v1/" ;
6
8
const Instance = axios . create ( {
7
9
baseURL : import . meta. env . VITE_BASE_URL
@@ -10,6 +12,10 @@ const Instance = axios.create({
10
12
timeout : 8000 ,
11
13
} ) ;
12
14
15
+ const getToken = ( ) => {
16
+ return Cookies . get ( TOKEN ) ;
17
+ } ;
18
+
13
19
export default function ApiCall < T > ( {
14
20
path,
15
21
method,
@@ -31,7 +37,7 @@ export default function ApiCall<T>({
31
37
} ,
32
38
] ,
33
39
headers : {
34
- Authorization : `Bearer ${ token } ` ,
40
+ Authorization : `Bearer ${ getToken ( ) || token } ` ,
35
41
} ,
36
42
} ) ;
37
43
}
You can’t perform that action at this time.
0 commit comments