Files
marmarislocal/app/[locale]/admin/neighborhoods/DeleteButton.tsx
T

24 lines
626 B
TypeScript

'use client'
import { deleteNeighborhoodAction } from '@/app/actions'
import { Trash } from 'lucide-react'
export function DeleteButton({ id }: { id: string }) {
return (
<button
type="button"
onClick={async () => {
if (!confirm('Bu mahalleyi silmek istediğinize emin misiniz?')) return
const res = await deleteNeighborhoodAction(id)
if (res?.error) {
alert(res.error)
}
}}
className="p-2 text-shutter hover:text-red-500 hover:bg-red-500/10 rounded-lg transition-colors"
title="Sil"
>
<Trash className="w-4 h-4" />
</button>
)
}