@Tray2
Frontend code
const handleSubmit = () => {
// let fromData=new FormData()
// fromData.append("name",inputData.name )
// fromData.append("password",inputData.password.trim() )
// fromData.append("id",userInfo.id )
const data = {
name: inputData.name,
password: inputData.password.trim(),
id : userInfo.id
};
if (inputData.name !== '' && inputData.password !== '') {
console.log(data)
console.log(config)
axios
.post(`${baseUrl}/profile/update`, data, config)
.then((res) => {
console.log(res.data)
if (res.data.result) {
toast.success('Successfully Updated !', {
position: toast.POSITION.TOP_CENTER,
});
} else {
toast.error('Server Error.. Try Again !', {
position: toast.POSITION.TOP_RIGHT,
});
}
})
.catch((err) => {
console.log(err)
toast.error('Server Error.. Try Again !', {
position: toast.POSITION.TOP_RIGHT,
});
});
}
};
Error message
user-information:1 Access to XMLHttpRequest at 'https://piarabazar.nabiaz.xyz/profile/update' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.