title: auto

des: auto
note:auto
This commit is contained in:
2023-11-09 14:55:15 +08:00
parent 93abcf220e
commit 4de3d8d43c
2 changed files with 17 additions and 17 deletions

View File

@@ -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>

View File

@@ -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);