Button Loading Collab, Voting & Investasi
This commit is contained in:
@@ -195,13 +195,21 @@ function ButtonAction({ value }: { value: any }) {
|
||||
return ComponentGlobal_NotifikasiPeringatan("Pilih Industri");
|
||||
|
||||
const res = await colab_funCreateProyek(value);
|
||||
if (res.status === 201) {
|
||||
setLoading(true);
|
||||
router.back();
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
try {
|
||||
setLoading(true)
|
||||
if (res.status === 201) {
|
||||
setLoading(true);
|
||||
router.back();
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
} else {
|
||||
setLoading(false)
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
setLoading(false)
|
||||
clientLogger.error("Error create proyek", error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
MODEL_COLLABORATION,
|
||||
MODEL_COLLABORATION_MASTER,
|
||||
} from "../model/interface";
|
||||
import { clientLogger } from "@/util/clientLogger";
|
||||
|
||||
export default function Colab_Edit({
|
||||
selectedData,
|
||||
@@ -211,12 +212,18 @@ function ButtonAction({ value }: { value: any }) {
|
||||
// return ComponentGlobal_NotifikasiPeringatan("Minimal Ada 2 Partisipan");
|
||||
|
||||
await colab_funEditById(value as any).then((res) => {
|
||||
if (res.status === 200) {
|
||||
try {
|
||||
setLoading(true);
|
||||
router.back();
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
if (res.status === 200) {
|
||||
router.back();
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
} else {
|
||||
setLoading(false)
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
setLoading(false)
|
||||
clientLogger.error("Error update proyek", error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -26,5 +26,5 @@ export default async function colab_funCreateProyek(
|
||||
|
||||
if (!data) return { status: 400, message: "Gagal Membuat Proyek" };
|
||||
revalidatePath(RouterColab.beranda);
|
||||
return { data, status: 201, message: "Berhasil Membuar Proyek" };
|
||||
return { data, status: 201, message: "Berhasil Membuat Proyek" };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user