Skip to content

Commit

Permalink
Merge pull request #78 from Choco-Express/dev
Browse files Browse the repository at this point in the history
🚀 Deploy
  • Loading branch information
Chaem03 authored Sep 23, 2024
2 parents 2a63f07 + 625f440 commit 2baf1c4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
10 changes: 2 additions & 8 deletions src/apis/otherBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,8 @@ import { instance } from "./instance";

export const getOtherBoxContents = async (box_id) => {
try {
const res = await instance.get(`/api/box/${box_id}`, {
headers: {
// 토큰이 없을 때 Authorization 헤더를 제거
Authorization: Cookies.get("access_token")
? `Bearer ${Cookies.get("access_token")}`
: undefined,
},
});
const res = await instance.get(`/api/box/${box_id}`);
console.log("Response data:", res.data);
return res;
} catch (err) {
console.log(err);
Expand Down
1 change: 1 addition & 0 deletions src/hooks/useOtherBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const useOtherBox = () => {
const fetchOtherBoxData = async () => {
try {
const res = await getOtherBoxContents(boxId);
console.log("훅입니다.res.data.result:", res.data.result);
setOtherData(res.data.result);
} catch (err) {
console.log(err);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/otherboxPage/otherboxPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const OtherboxPage = () => {
const navigate = useNavigate();
const location = useLocation();
const token = Cookies.get("access_token");
const boxId = otherData.boxId;
const boxId = otherData ? otherData.boxId : null;

const MoveOnLetterP = () => {
if (!token) {
Expand Down

0 comments on commit 2baf1c4

Please sign in to comment.