feat:delete iklan
This commit is contained in:
parent
1f7c07121a
commit
f3abd767ba
|
|
@ -31,7 +31,7 @@ import {
|
|||
DialogTrigger,
|
||||
} from "@/components/ui/dialog";
|
||||
import { Collapsible, CollapsibleContent } from "@/components/ui/collapsible";
|
||||
import { setBanner } from "@/service/settings/settings";
|
||||
import { deleteAdvertisements, setBanner } from "@/service/settings/settings";
|
||||
import { error } from "@/config/swal";
|
||||
import { useToast } from "@/components/ui/use-toast";
|
||||
import withReactContent from "sweetalert2-react-content";
|
||||
|
|
@ -85,7 +85,7 @@ const columns: ColumnDef<any>[] = [
|
|||
id,
|
||||
};
|
||||
|
||||
const response = await deleteMedia(data);
|
||||
const response = await deleteAdvertisements(id);
|
||||
|
||||
if (response?.error) {
|
||||
error(response.message);
|
||||
|
|
@ -107,7 +107,7 @@ const columns: ColumnDef<any>[] = [
|
|||
});
|
||||
}
|
||||
|
||||
const handleDeleteMedia = (id: any) => {
|
||||
const handleDeleteAdvertisements = (id: any) => {
|
||||
MySwal.fire({
|
||||
title: "Hapus Data",
|
||||
text: "",
|
||||
|
|
@ -146,7 +146,7 @@ const columns: ColumnDef<any>[] = [
|
|||
</DropdownMenuItem>
|
||||
</Link>
|
||||
<DropdownMenuItem
|
||||
onClick={() => handleDeleteMedia(row.original.id)}
|
||||
onClick={() => handleDeleteAdvertisements(row.original.id)}
|
||||
className="p-2 border-b text-destructive bg-destructive/30 focus:bg-destructive focus:text-destructive-foreground rounded-none"
|
||||
>
|
||||
<Trash2 className="w-4 h-4 me-1.5" />
|
||||
|
|
|
|||
|
|
@ -524,15 +524,14 @@ export function TambahIklanDetail() {
|
|||
<p className="text-xs text-red-500">
|
||||
(Warning: Foto yang di upload adalah Foto Potrait)
|
||||
</p>
|
||||
<Card className="mt-2">
|
||||
|
||||
<Image
|
||||
src={`https://netidhub.com/api/advertisements/viewer/${id}`}
|
||||
alt="Thumbnail Gambar Utama"
|
||||
className=" rounded-md"
|
||||
className=" rounded-md my-3"
|
||||
width={300}
|
||||
height={500}
|
||||
/>
|
||||
</Card>
|
||||
</div>
|
||||
<div>
|
||||
<p className="font-medium">Deskripsi</p>
|
||||
|
|
|
|||
|
|
@ -508,15 +508,14 @@ export function TambahIklanUpdate() {
|
|||
</div>
|
||||
</div>
|
||||
))}
|
||||
<Card className="mt-2">
|
||||
|
||||
<Image
|
||||
src={`https://netidhub.com/api/advertisements/viewer/${id}`}
|
||||
alt="Thumbnail Gambar Utama"
|
||||
className=" rounded-md"
|
||||
className=" rounded-md my-3"
|
||||
width={300}
|
||||
height={500}
|
||||
/>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -142,3 +142,8 @@ export async function detailAdvertisements(id: any) {
|
|||
const url = `advertisements?id=${id}`;
|
||||
return httpGetInterceptor(url);
|
||||
}
|
||||
|
||||
export async function deleteAdvertisements(id: string | number) {
|
||||
const url = `advertisements?id=${id}`;
|
||||
return httpDeleteInterceptor(url);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue