fix: spit tags edit
This commit is contained in:
parent
54633d8936
commit
74265cb797
|
|
@ -294,12 +294,11 @@ export default function FormConvertSPIT() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadDetail = async () => {
|
const loadDetail = async () => {
|
||||||
loading()
|
loading();
|
||||||
try {
|
try {
|
||||||
const response = await detailSPIT(id);
|
const response = await detailSPIT(id);
|
||||||
const details = response?.data?.data;
|
const details = response?.data?.data;
|
||||||
setIsAlreadySaved(details?.isPublish ? true : false)
|
setIsAlreadySaved(details?.isPublish ? true : false);
|
||||||
|
|
||||||
|
|
||||||
if (!details) {
|
if (!details) {
|
||||||
throw new Error("Detail not found");
|
throw new Error("Detail not found");
|
||||||
|
|
@ -341,7 +340,7 @@ export default function FormConvertSPIT() {
|
||||||
console.error("Failed to load detail:", error);
|
console.error("Failed to load detail:", error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
close()
|
close();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCategoryChange = async (categoryId: string) => {
|
const handleCategoryChange = async (categoryId: string) => {
|
||||||
|
|
@ -565,6 +564,18 @@ export default function FormConvertSPIT() {
|
||||||
|
|
||||||
// Form submission
|
// Form submission
|
||||||
const onSubmit = async (data: FormData) => {
|
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)) {
|
if (!checkPlacement(filePlacements)) {
|
||||||
error("Select File Placement");
|
error("Select File Placement");
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -613,7 +624,7 @@ export default function FormConvertSPIT() {
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
// router.push("/in/contributor/content/spit");
|
// router.push("/in/contributor/content/spit");
|
||||||
// router.replace(`${window.location.pathname}?id=${id}`);
|
// router.replace(`${window.location.pathname}?id=${id}`);
|
||||||
loadDetail()
|
loadDetail();
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to save:", error);
|
console.error("Failed to save:", error);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue