temp/src/Components/Utilities/PartCPlaygroundUtilities.jsx

37 lines
991 B
JavaScript

import { toast } from "react-toastify";
const saveRotatedImage = async (imageName,tableNameData,rotateAngle,data, setIsLoading) => {
try {
console.log("data=", data)
if (rotateAngle === 0) {
return;
}
const payload = {
imageName,
tableNameData,
rotateAngle,
s3_path: data["s3_path"],
};
setIsLoading(true);
const response = await fetch(
`${import.meta.env.VITE_REACT_APP_BACKEND_URL}/saveRotatedImage`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
}
);
setIsLoading(false);
const responseData = await response.json();
if (responseData.status === "success") {
toast.success("Image Rotation Saved Successfully")
}
} catch (error) {
setIsLoading(false);
throw new Error(error);
}
};
export default saveRotatedImage