temp/src/Components/Utilities/PartCPlaygroundUtilities.jsx

34 lines
930 B
React
Raw Normal View History

2024-07-11 18:25:52 +05:30
import { toast } from "react-toastify";
export const saveRotatedImage = async (tableName,tableNameData,rotateAngle,s3_path,data) => {
try {
if (rotateAngle === 0) {
return;
}
const payload = {
imageName,
tableNameData,
rotateAngle,
s3_path: data[s3_image_column],
};
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);
}
};