Skip to content

Commit

Permalink
Merge pull request #75 from Chaem03/feature/#22
Browse files Browse the repository at this point in the history
Fix: 상대방 박스조회  API 요청 오류 수정
  • Loading branch information
Chaem03 authored Sep 23, 2024
2 parents c40deaf + 46c47ae commit cc4c4b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/apis/instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ instance.interceptors.request.use(
if (accessToken) {
config.headers["Authorization"] = `Bearer ${accessToken}`; // 액세스 토큰이 있으면 헤더에 추가합니다.
config.withCredentials = true;
} else {
delete config.headers["Authorization"]; // 토큰이 없으면 헤더를 삭제
}

return config;
Expand Down
5 changes: 4 additions & 1 deletion src/apis/otherBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ export const getOtherBoxContents = async (box_id) => {
try {
const res = await instance.get(`/api/box/${box_id}`, {
headers: {
// Authorization 헤더를 포함하지 않음
// 토큰이 없을 때 Authorization 헤더를 제거
Authorization: Cookies.get("access_token")
? `Bearer ${Cookies.get("access_token")}`
: undefined,
},
});
return res;
Expand Down

0 comments on commit cc4c4b3

Please sign in to comment.