[React/Axios] axios delete ์š”์ฒญ ์‹œ body์— data ๋„ฃ๋Š” ๋ฐฉ๋ฒ•
ยท
Frontend/React
๐Ÿšจ ์˜ค๋ฅ˜ ๋ฐœ์ƒ AxiosError message: 'Request failed with status code 400' axios.delete(`${url}/unlike`, { projectId: id, }) axios์˜ delete๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์„œ๋ฒ„์— ์š”์ฒญ์„ ํ•  ๋•Œ, ๋‹ค์Œ๊ณผ ๊ฐ™์ด data๋ฅผ ์ „๋‹ฌํ•˜๋ฉด ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค. ๐Ÿ’ก ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• axios.delete๋Š” request body๋ฅผ ์ง€์›ํ•˜๋ฉฐ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋‘๊ฐœ์˜ ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ํ—ˆ์šฉํ•œ๋‹ค. axios.delete(url[, config]) ๐Ÿ‘ config.data๋Š” request body๋ฅผ ์„ค์ •ํ•˜๋Š”๋ฐ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค. axios.delete(`${url}/unlike`, { data: { projectId: id, }, }) 2๋ฒˆ์งธ ์ธ์ž์—์„œ data๋ฅผ data: {}..
_์„ฑํ˜ธ_
'Delete' ํƒœ๊ทธ์˜ ๊ธ€ ๋ชฉ๋ก