-
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.
Browse files
Browse the repository at this point in the history
feat: 일지 업데이트 및 생성 API
- Loading branch information
Showing
4 changed files
with
103 additions
and
34 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,26 @@ | ||
import axios from "axios"; | ||
|
||
const updateDiary = async (formDataToSend, csrfToken, journalId) => { | ||
console.log("API 코드에서 잘 넘어왔는지", formDataToSend, csrfToken, journalId); | ||
try { | ||
const serverResponse = await axios.put( | ||
`${process.env.REACT_APP_HOST_URL}/v1/journals/${journalId}`, | ||
formDataToSend, | ||
{ | ||
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 updateDiary; |
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