add function creatPost and login wp
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { deletePost } from "../wordpress";
|
||||
|
||||
function DeletePost({ postId, onDelete }) {
|
||||
const handleDelete = async () => {
|
||||
if (window.confirm("Es-tu sûr de vouloir supprimer cet article ?")) {
|
||||
const success = await deletePost(postId);
|
||||
if (success) {
|
||||
alert("Article supprimé avec succès !");
|
||||
onDelete(); // Rafraîchir la liste
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return <button onClick={handleDelete}>🗑️ Supprimer</button>;
|
||||
}
|
||||
|
||||
export default DeletePost;
|
||||
Reference in New Issue
Block a user