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" />}> <AppShell header={<HeaderTamplate title="Edit Intro" />}>
<Stack> <Stack>
<Text>v1.0.3</Text> <Text>v1.0.4</Text>
{children} {children}
</Stack> </Stack>
</AppShell> </AppShell>

View File

@@ -38,24 +38,24 @@ export default async function funEditInvestasi(
// }; // };
// } // }
const file: any = formData.get("file"); // const file: any = formData.get("file");
const fName = file.name; // const fName = file.name;
const fExt = // const fExt =
file && file.name ? _.lowerCase(file.name.split(".").pop()) : ""; // file && file.name ? _.lowerCase(file.name.split(".").pop()) : "";
const fRandomName = "file_" + _.random(100000000, 999999999999) + "." + fExt; // const fRandomName = "file_" + _.random(100000000, 999999999999) + "." + fExt;
const updateImage = await prisma.images.update({ // const updateImage = await prisma.images.update({
where: { // where: {
id: data.imagesId, // id: data.imagesId,
}, // },
data: { // data: {
url: fRandomName, // url: fRandomName,
}, // },
}); // });
if (!updateImage) return { status: 400, message: "Gagal upload gambar" }; // if (!updateImage) return { status: 400, message: "Gagal upload gambar" };
const upFolder = Buffer.from(await file.arrayBuffer()); // const upFolder = Buffer.from(await file.arrayBuffer());
fs.writeFileSync(`./public/investasi/${updateImage.url}`, upFolder); // fs.writeFileSync(`./public/investasi/${updateImage.url}`, upFolder);
} }
// revalidatePath(RouterInvestasi.detail_draft); // revalidatePath(RouterInvestasi.detail_draft);