This commit is contained in:
hanif salafi 2025-06-08 22:13:16 +07:00
commit 0fe0971628
4 changed files with 25 additions and 22 deletions

View File

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

View File

@ -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"
width={300}
height={500}
/>
</Card>
<Image
src={`https://netidhub.com/api/advertisements/viewer/${id}`}
alt="Thumbnail Gambar Utama"
className=" rounded-md my-3"
width={300}
height={500}
/>
</div>
<div>
<p className="font-medium">Deskripsi</p>

View File

@ -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"
width={300}
height={500}
/>
</Card>
<Image
src={`https://netidhub.com/api/advertisements/viewer/${id}`}
alt="Thumbnail Gambar Utama"
className=" rounded-md my-3"
width={300}
height={500}
/>
</div>
<div>

View File

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