This commit is contained in:
hanif salafi 2025-08-07 10:40:19 +07:00
commit 090006fa30
1 changed files with 16 additions and 5 deletions

View File

@ -297,12 +297,11 @@ export default function FormConvertSPIT() {
};
const loadDetail = async () => {
loading()
loading();
try {
const response = await detailSPIT(id);
const details = response?.data?.data;
setIsAlreadySaved(details?.isPublish ? true : false)
setIsAlreadySaved(details?.isPublish ? true : false);
if (!details) {
throw new Error("Detail not found");
@ -344,7 +343,7 @@ export default function FormConvertSPIT() {
console.error("Failed to load detail:", error);
throw error;
}
close()
close();
};
const handleCategoryChange = async (categoryId: string) => {
@ -568,6 +567,18 @@ export default function FormConvertSPIT() {
// Form submission
const onSubmit = async (data: FormData) => {
const pnmhTags = tags.filter((tag) => tag.toLowerCase().includes("pnmh"));
if (pnmhTags.length > 1) {
MySwal.fire({
title: "Error",
text: "Tags penugasan hanya diperbolehkan 1 (satu) saja.",
icon: "error",
confirmButtonColor: "#3085d6",
});
return false;
}
if (!checkPlacement(filePlacements)) {
error("Select File Placement");
return false;
@ -616,7 +627,7 @@ export default function FormConvertSPIT() {
}).then(() => {
// router.push("/in/contributor/content/spit");
// router.replace(`${window.location.pathname}?id=${id}`);
loadDetail()
loadDetail();
});
} catch (error) {
console.error("Failed to save:", error);