feat: add prisma support, admin panel and auth
This commit is contained in:
29
app/admin/components/DeleteButton.tsx
Normal file
29
app/admin/components/DeleteButton.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
'use client';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
interface DeleteButtonProps {
|
||||
onDelete: () => Promise<void>;
|
||||
}
|
||||
|
||||
export default function DeleteButton({ onDelete }: DeleteButtonProps) {
|
||||
const [loading, setLoading] = React.useState(false);
|
||||
|
||||
async function handleClick() {
|
||||
if (confirm('Bu öğeyi silmek istediğinizden emin misiniz?')) {
|
||||
setLoading(true);
|
||||
await onDelete();
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<button
|
||||
onClick={handleClick}
|
||||
className="action-btn delete"
|
||||
disabled={loading}
|
||||
>
|
||||
{loading ? '...' : 'Sil'}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user