Kabar Donasi
# feat - Create kabar - Delete kabar - List kabar ## No issue
This commit is contained in:
@@ -13,13 +13,20 @@ import { useRouter } from "next/navigation";
|
||||
import React from "react";
|
||||
import FooterDonasi from "../../component/footer_close_donasi";
|
||||
import HeaderTamplateDonasi from "../../component/header_tamplate";
|
||||
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||
import { Donasi_funDeleteKabar } from "../../fun/delete/fun_delete.kabar";
|
||||
import { NotifBerhasil } from "../../component/notifikasi/notif_berhasil";
|
||||
import { NotifGagal } from "../../component/notifikasi/notif_gagal";
|
||||
|
||||
export default function LayoutUpdateKabarDonasi({
|
||||
children,
|
||||
kabarId
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
kabarId: string
|
||||
}) {
|
||||
const router = useRouter();
|
||||
|
||||
return (
|
||||
<>
|
||||
<AppShell
|
||||
@@ -27,10 +34,10 @@ export default function LayoutUpdateKabarDonasi({
|
||||
footer={
|
||||
<Footer height={70}>
|
||||
<Group align="center" h={"100%"} position="center" spacing={"xl"}>
|
||||
<Button radius={"xl"} variant="outline" color="green">
|
||||
{/* <Button radius={"xl"} variant="outline" color="green">
|
||||
Edit
|
||||
</Button>
|
||||
<Button radius={"xl"} variant="outline" color="red">
|
||||
</Button> */}
|
||||
<Button radius={"xl"} variant="outline" color="red" onClick={() => onDelete(router,kabarId )}>
|
||||
Hapus
|
||||
</Button>
|
||||
</Group>
|
||||
@@ -42,3 +49,15 @@ export default function LayoutUpdateKabarDonasi({
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
async function onDelete(router: AppRouterInstance ,kabarId: string) {
|
||||
await Donasi_funDeleteKabar(kabarId)
|
||||
.then((res) => {
|
||||
if(res.status === 200){
|
||||
router.back()
|
||||
NotifBerhasil(res.message)
|
||||
} else {
|
||||
NotifGagal(res.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user