안녕하세요,
토픽에 파일을 업로드할 수 있는 커스텀 필드를 추가했습니다. 토픽 생성 시 또는 저장/편집 버튼을 클릭할 때 파일을 업로드하려고 합니다. /uploads.json API를 사용하여 파일은 정상적으로 업로드되지만, 어째서인지 데이터베이스에 데이터를 업데이트하지 못하겠습니다.
아래 코드를 사용했습니다:
api.modifyClass(“service:composer”, {>
save() {
const model = this.get(‘model’);
if (model.action === ‘createTopic’ || (model.action === ‘edit’)) {
const fileInput = document.getElementById(‘fileUpload’);const file = fileInput.files[0]; if (file) { uploadImage(file).then(url => { // 커스텀 필드 값 설정 model.set('topic_file_upload', url); this._super(...arguments); }).catch(error => { console.log('error', error); }); } } }, });
무엇을 놓치고 있는 걸까요? 도와주실 수 있나요?
감사합니다!