인프런 커뮤니티 질문&답변
axios 질문입니다.
작성
·
225
0
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요!
- 먼저 유사한 질문이 있었는지 검색해보세요.
- 서로 예의를 지키며 존중하는 문화를 1. 데이터 저장
- 먼저 유사한 질문이 있었는지 검색해보세요.
- 서로 예의를 지키며 존중하는 문화를 1. 데이터 저장
const formdata = new FormData();
formdata.append('user_idx', userIdx);
formdata.append('date', date);
formdata.append('memo', memo);
formdata.append('type', 'file');
formdata.append('image', {
name: imageUri.fileName,
type: imageUri.type,
uri: imageUri.uri,
});
2. axios post
axios.post('url/photo', formdata, {
headers: {
'x-access-token':'',
Accept: 'application/json',
'Content-Type': 'multipart/form-data',
},
})
.then(res => {
console.log('success', res);
})
.catch(() => {
console.log('err');
});
의 코드인데,
api 연동이 안되고 err 콘솔만 찍혀요 .. 어디가 잘못됐을까요 ?






네, 방금
주석 부분 추가하여 해결했습니다.
추가해야 작동하는 이유를 알 수 있을까요 ?