34 lines
930 B
React
34 lines
930 B
React
|
|
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);
|
||
|
|
}
|
||
|
|
};
|