Javascript eNote:没有这样的文件或目录,stat..\client\build\index.html
尝试使用axios.put将已上载到AWS的图像放入React应用程序中的MongoDB数据库时出现此错误。在我尝试从useselector插入用户id以将图像与当前用户配置文件图像关联之前,一切都正常。如果需要,可以上传更多代码Javascript eNote:没有这样的文件或目录,stat..\client\build\index.html,javascript,node.js,reactjs,mongodb,redux,Javascript,Node.js,Reactjs,Mongodb,Redux,尝试使用axios.put将已上载到AWS的图像放入React应用程序中的MongoDB数据库时出现此错误。在我尝试从useselector插入用户id以将图像与当前用户配置文件图像关联之前,一切都正常。如果需要,可以上传更多代码 import React, { Component } from 'react'; import axios from 'axios'; import $ from 'jquery'; import API from '../../utils/API' import
import React, { Component } from 'react';
import axios from 'axios';
import $ from 'jquery';
import API from '../../utils/API'
import { useSelector } from "react-redux";
class ImageUpload extends Component {constructor( props ) {
...
} else {
// Success
const user = useSelector(state => state.auth.currentUser);
let fileName = response.data;
console.log( 'fileName', fileName );
this.ocShowAlert( 'File Uploaded', '#3089cf' );
const imageName = fileName.image;
const imageLocation = fileName.location;
const imageData = {
"profileimage": [
{
"imagename": imageName
},
{
"imagelocation": imageLocation
}
]
}
API.editUser(user._id, imageData)
.then(() => {
console.log("Yo you updated the profile image");
console.log(user);
})
}
}
}).catch( ( error ) => {
// If another error
this.ocShowAlert( error, 'red' );
});
} else {
// if file not selected throw error
this.ocShowAlert( 'Please upload file', 'red' );
}
}