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 2727 "echarts-for-react" : " ^3.0.2" ,
2828 "framer-motion" : " ^9.0.2" ,
2929 "html-react-parser" : " ^3.0.16" ,
30+ "js-cookie" : " ^3.0.5" ,
3031 "minimist" : " ^1.2.8" ,
3132 "query-string" : " ^8.1.0" ,
3233 "react" : " ^18.2.0" ,
Original file line number Diff line number Diff line change 11import axios from "axios" ;
2+ // eslint-disable-next-line import/no-extraneous-dependencies
3+ import Cookies from "js-cookie" ;
24import { TAxiosWrapper } from "../types" ;
35
4- const TOKEN = "clerk-db-jwt " ;
6+ const TOKEN = "__session " ;
57const PATH_PREFIX = "/api/v1/" ;
68const Instance = axios . create ( {
79 baseURL : import . meta. env . VITE_BASE_URL
@@ -10,6 +12,10 @@ const Instance = axios.create({
1012 timeout : 8000 ,
1113} ) ;
1214
15+ const getToken = ( ) => {
16+ return Cookies . get ( TOKEN ) ;
17+ } ;
18+
1319export default function ApiCall < T > ( {
1420 path,
1521 method,
@@ -31,7 +37,7 @@ export default function ApiCall<T>({
3137 } ,
3238 ] ,
3339 headers : {
34- Authorization : `Bearer ${ token } ` ,
40+ Authorization : `Bearer ${ getToken ( ) || token } ` ,
3541 } ,
3642 } ) ;
3743}
You can’t perform that action at this time.
0 commit comments