in TailwindTraders.Website/Source/Tailwind.Traders.Web/ClientApp/src/shared/uploadFile/uploadFile.js [15:42]
uploadFile(e) {
const file = e.target.files[0];
const formData = new FormData();
formData.append("file", file);
ProductService.getRelatedProducts(formData, this.props.userInfo.token)
.then((relatedProducts) => {
if (relatedProducts.length > 1) {
this.props.history.push({
pathname: "/suggested-products-list",
state: { relatedProducts },
});
}else {
this.props.history.push({
pathname: `/product/detail/${relatedProducts[0].id}`,
});
}
})
.catch(() => {
Alert.error("There was an error uploading the image, please try again", {
position: "top",
effect: "scale",
beep: true,
timeout: 6000,
});
});
}