diff --git a/src/mainPage/features/interactions/mock.js b/src/mainPage/features/interactions/mock.js index 7d06621d..2d94f56c 100644 --- a/src/mainPage/features/interactions/mock.js +++ b/src/mainPage/features/interactions/mock.js @@ -9,6 +9,11 @@ const handlers = [ HttpResponse.json(eventParticipationDate), ), http.post("/api/v1/event/draw/:eventId/participation", () => HttpResponse.json(true)), + http.post("/api/v1/url/shorten", () => + HttpResponse.json({ + shortUrl: "o1PiWwlZZU", + }), + ), ]; export default handlers; diff --git a/src/mainPage/features/interactions/modal/InteractionAnswer.jsx b/src/mainPage/features/interactions/modal/InteractionAnswer.jsx index b341a41b..e8d9c997 100644 --- a/src/mainPage/features/interactions/modal/InteractionAnswer.jsx +++ b/src/mainPage/features/interactions/modal/InteractionAnswer.jsx @@ -29,20 +29,17 @@ export default function InteractionAnswer({ isAnswerUp, setIsAnswerUp, answer, c function onClickShare() { setIsAniPlaying(true); - - // 단축 URL 받아오는 요청. 추후 수정 필요 fetchServer( - `/api/v1/url/shorten?originalUrl=https%3A%2F%2Fsofteer-awesome-orange.vercel.app%2F&userId=1`, + `/api/v1/url/shorten?originalUrl=https%3A%2F%2Fsofteer-awesome-orange.vercel.app%2F`, { method: "POST", }, ) - .then((res) => { - console.log(res); - navigator.clipboard.writeText("https://youtu.be/KMU0tzLwhbE"); + .then(({ shortUrl }) => { + navigator.clipboard.writeText(`http://softeerorange.store/api/v1/url/${shortUrl}`); }) - .catch((e) => { - console.log(e); + .catch(() => { + navigator.clipboard.writeText("https://softeer-awesome-orange.vercel.app/"); }); } @@ -58,6 +55,7 @@ export default function InteractionAnswer({ isAnswerUp, setIsAnswerUp, answer, c