Skip to content

Commit fa85837

Browse files
committed
๐Ÿ›fix: client accessToken header ์•ˆ๋ฐ›๊ฒŒ ์ˆ˜์ •
1 parent 42af227 commit fa85837

2 files changed

Lines changed: 22 additions & 13 deletions

File tree

โ€Žsrc/api/client.tsxโ€Ž

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ export const authClient = axios.create({
2727
},
2828
});
2929

30-
client.interceptors.request.use(
31-
(config) => {
32-
const accessToken = getAccessToken();
33-
if (accessToken && config.headers) {
34-
config.headers.Authorization = `Bearer ${accessToken}`;
35-
}
36-
return config;
37-
},
38-
(error) => {
39-
return Promise.reject(error);
40-
}
41-
);
30+
// client.interceptors.request.use(
31+
// (config) => {
32+
// const accessToken = getAccessToken();
33+
// if (accessToken && config.headers) {
34+
// config.headers.Authorization = `Bearer ${accessToken}`;
35+
// }
36+
// return config;
37+
// },
38+
// (error) => {
39+
// return Promise.reject(error);
40+
// }
41+
// );
4242

4343
authClient.interceptors.request.use(
4444
(config) => {

โ€Žsrc/api/planet/space/space.tsxโ€Ž

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
import client, { authClient } from "@/api/client";
2+
import { getAccessToken } from "@/utils/storage";
23

34
// ๋ฉ”์ธ ์ŠคํŽ˜์ด์Šค ์•„์ด๋”” ์กฐํšŒ
45
export const getMainId = async () => {
5-
return await client.get(`/api/v1/spaces/main`);
6+
const accessToken = getAccessToken();
7+
8+
const response = await client.get(`/api/v1/spaces/main`, {
9+
headers: {
10+
Authorization: `Bearer ${accessToken}`,
11+
},
12+
});
13+
14+
return response;
615
};
716

817
// ์ „์ฒด ์ŠคํŽ˜์ด์Šค ๋ชฉ๋ก ์กฐํšŒ

0 commit comments

Comments
ย (0)