-
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.
- Loading branch information
JongHyun
authored and
JongHyun
committed
Aug 2, 2024
1 parent
387854e
commit a40177b
Showing
6 changed files
with
70 additions
and
50 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,26 @@ | ||
import axios from "axios"; | ||
|
||
const createDiary = async (formDataToSend, csrfToken, goalId) => { | ||
console.log("API 코드에서 잘 넘어왔는지", formDataToSend, csrfToken, goalId); | ||
try { | ||
const serverResponse = await axios.post( | ||
`${process.env.REACT_APP_HOST_URL}/v1/goals/${goalId}/journals`, | ||
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 createDiary; |
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
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