Skip to content

Commit 6989ef3

Browse files
committed
lost changes
1 parent 91b4041 commit 6989ef3

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

composables/useSGCAxios.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import axios from "axios";
2+
3+
export default function (config, fulfilled = undefined, rejected = undefined) {
4+
const sgcAxios = axios.create({
5+
baseURL: config.public.apiBaseUrl,
6+
headers: {
7+
"Content-Type": "application/json",
8+
},
9+
});
10+
11+
// Add JWT token interceptor for SGC requests
12+
sgcAxios.interceptors.request.use(config => {
13+
const token = localStorage.getItem('sgcAuthToken');
14+
if (token) {
15+
config.headers.Authorization = `Bearer ${token}`;
16+
}
17+
return config;
18+
});
19+
20+
// Add response interceptors (with optional custom handlers)
21+
sgcAxios.interceptors.response.use(fulfilled, rejected);
22+
23+
return sgcAxios;
24+
}

0 commit comments

Comments
 (0)