-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/LikeLionHGU/Namsong3-Front …
…into eunju_feat/#125
- Loading branch information
Showing
6 changed files
with
154 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import axios from "axios"; | ||
|
||
const deleteDiary = async (csrfToken, journalId) => { | ||
console.log("API 코드에서 잘 넘어왔는지", csrfToken, journalId); | ||
try { | ||
const serverResponse = await axios.delete(`${process.env.REACT_APP_HOST_URL}/v1/journals/${journalId}`, { | ||
withCredentials: true, | ||
headers: { | ||
"Content-Type": "application/json", | ||
"X-CSRF-TOKEN": csrfToken, | ||
}, | ||
}); | ||
console.log("일지가 정상적으로 삭제되었음", serverResponse); | ||
|
||
return serverResponse.data; | ||
} catch (error) { | ||
console.error("일지 삭제 실패:", error); | ||
throw error; | ||
} | ||
}; | ||
|
||
export default deleteDiary; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.