diff --git a/src/app_modules/investasi/edit_intro/view.tsx b/src/app_modules/investasi/edit_intro/view.tsx index 876dbb2e..f655eb34 100644 --- a/src/app_modules/investasi/edit_intro/view.tsx +++ b/src/app_modules/investasi/edit_intro/view.tsx @@ -63,7 +63,6 @@ export default function EditIntroInvestasi({ async function onUpdate() { const body = edit_inves; if (_.values(edit_inves).includes("")) return toast("Lengkapi data"); - // if (!fl) return toast("File Kosong"); const fd = new FormData(); fd.append("file", fl as any); @@ -72,11 +71,6 @@ export default function EditIntroInvestasi({ res.status === 200 ? (toast(res.message), router.back()) : toast(res.message); - // if (res.status === 200) { - // router.back() - // } else { - // toast(res.message); - // } }); } @@ -90,8 +84,12 @@ export default function EditIntroInvestasi({ withCloseButton={false} > - - + + @@ -249,7 +247,7 @@ export default function EditIntroInvestasi({ bg={Warna.hijau_muda} color="green" onClick={() => { - scrollTo({y: 0}) + scrollTo({ y: 0 }); open(); }} > diff --git a/src/app_modules/investasi/fun/fun_edit_investasi.ts b/src/app_modules/investasi/fun/fun_edit_investasi.ts index 6b95b43d..c487b03a 100644 --- a/src/app_modules/investasi/fun/fun_edit_investasi.ts +++ b/src/app_modules/investasi/fun/fun_edit_investasi.ts @@ -15,34 +15,34 @@ export default async function funEditInvestasi( const file = formData.get("file"); if (file !== "null") { - const editInves = await prisma.investasi.update({ - where: { - id: data.id, - }, - data: { - title: data.title, - targetDana: data.targetDana, - hargaLembar: data.hargaLembar, - totalLembar: data.totalLembar, - roi: data.roi, - masterPencarianInvestorId: data.MasterPencarianInvestor.id, - masterPembagianDevidenId: data.MasterPembagianDeviden.id, - masterPeriodeDevidenId: data.MasterPeriodeDeviden.id, - }, - }); + // const editInves = await prisma.investasi.update({ + // where: { + // id: data.id, + // }, + // data: { + // title: data.title, + // targetDana: data.targetDana, + // hargaLembar: data.hargaLembar, + // totalLembar: data.totalLembar, + // roi: data.roi, + // masterPencarianInvestorId: data.MasterPencarianInvestor.id, + // masterPembagianDevidenId: data.MasterPembagianDeviden.id, + // masterPeriodeDevidenId: data.MasterPeriodeDeviden.id, + // }, + // }); - if (!editInves) { - return { - status: 400, - message: "Gagal update", - }; - } + // if (!editInves) { + // return { + // status: 400, + // message: "Gagal update", + // }; + // } const file: any = formData.get("file"); const fName = file.name; const fExt = file && file.name ? _.lowerCase(file.name.split(".").pop()) : ""; - const fRandomName = editInves.id + "." + fExt; + const fRandomName = "file_" + _.random(100000000, 999999999999) + "." + fExt; const updateImage = await prisma.images.update({ where: {