Skip to content

Commit

Permalink
Merge pull request #127 from LikeLionHGU/jongyhun_feat/#123
Browse files Browse the repository at this point in the history
fix : 이미지 업로드 url 수정
  • Loading branch information
dkrehd0519 authored Aug 6, 2024
2 parents 1b99210 + 702ac2d commit 68147a6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions src/apis/createImg.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import axios from "axios";

const createImg = async (csrfToken, formData) => {
try {
const serverResponse = await axios.post(`${process.env.REACT_APP_HOST_URL}/v1/images`, formData, {
withCredentials: true,
headers: {
"X-CSRF-TOKEN": csrfToken,
"Content-Type": "multipart/form-data",
},
});
console.log("이미지가 정상적으로 추가되었음", serverResponse);

return serverResponse.data.imageUrl;
} catch (error) {
console.error("이미지 추가 실패:", error);
throw error;
}
};

export default createImg;
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Toggle } from "./Toggle";
import { CSSTransition, TransitionGroup } from "react-transition-group";
import updateGoal from "../../../../apis/updateGoal";
import { fi } from "date-fns/locale";
import createImg from "../../../../apis/\bcreateImg";
import createImg from "../../../../apis/createImg";

const formatDate = (date) => {
const year = date.getFullYear();
Expand Down

0 comments on commit 68147a6

Please sign in to comment.