We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 91b4041 commit 6989ef3Copy full SHA for 6989ef3
composables/useSGCAxios.js
@@ -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