title: auto
des: auto note:auto
This commit is contained in:
@@ -13,7 +13,7 @@ export default function LayoutEditIntroInvestasi({
|
||||
<>
|
||||
<AppShell header={<HeaderTamplate title="Edit Intro" />}>
|
||||
<Stack>
|
||||
<Text>v1.0.3</Text>
|
||||
<Text>v1.0.4</Text>
|
||||
{children}
|
||||
</Stack>
|
||||
</AppShell>
|
||||
|
||||
@@ -38,24 +38,24 @@ export default async function funEditInvestasi(
|
||||
// };
|
||||
// }
|
||||
|
||||
const file: any = formData.get("file");
|
||||
const fName = file.name;
|
||||
const fExt =
|
||||
file && file.name ? _.lowerCase(file.name.split(".").pop()) : "";
|
||||
const fRandomName = "file_" + _.random(100000000, 999999999999) + "." + fExt;
|
||||
// const file: any = formData.get("file");
|
||||
// const fName = file.name;
|
||||
// const fExt =
|
||||
// file && file.name ? _.lowerCase(file.name.split(".").pop()) : "";
|
||||
// const fRandomName = "file_" + _.random(100000000, 999999999999) + "." + fExt;
|
||||
|
||||
const updateImage = await prisma.images.update({
|
||||
where: {
|
||||
id: data.imagesId,
|
||||
},
|
||||
data: {
|
||||
url: fRandomName,
|
||||
},
|
||||
});
|
||||
// const updateImage = await prisma.images.update({
|
||||
// where: {
|
||||
// id: data.imagesId,
|
||||
// },
|
||||
// data: {
|
||||
// url: fRandomName,
|
||||
// },
|
||||
// });
|
||||
|
||||
if (!updateImage) return { status: 400, message: "Gagal upload gambar" };
|
||||
const upFolder = Buffer.from(await file.arrayBuffer());
|
||||
fs.writeFileSync(`./public/investasi/${updateImage.url}`, upFolder);
|
||||
// if (!updateImage) return { status: 400, message: "Gagal upload gambar" };
|
||||
// const upFolder = Buffer.from(await file.arrayBuffer());
|
||||
// fs.writeFileSync(`./public/investasi/${updateImage.url}`, upFolder);
|
||||
}
|
||||
|
||||
// revalidatePath(RouterInvestasi.detail_draft);
|
||||
|
||||
Reference in New Issue
Block a user