Skip to content
Snippets Groups Projects
Commit 298d57fd authored by Salomo309's avatar Salomo309
Browse files

feat: integrate delete song

parent 831aff19
1 merge request!1Dev
import React from 'react'; import axios from 'axios';
import { useNavigate, useParams } from 'react-router';
const DeleteSongDialog = () => {
const { albumId, songId } = useParams();
const navigate = useNavigate();
const handleDeleteSong = () => {
try {
axios.delete(`http://localhost:3000/api/premium-album/${albumId}/${songId}`);
} catch (error) {
console.error('Error deleting song:', error);
}
};
const handleCancel = () => {
navigate(-1);
};
const DeleteSongDialog: React.FC = () => {
return ( return (
<> <>
{( {(
...@@ -14,14 +29,16 @@ const DeleteSongDialog: React.FC = () => { ...@@ -14,14 +29,16 @@ const DeleteSongDialog: React.FC = () => {
<div className="mb-4">Are you sure you want to delete this Song?</div> <div className="mb-4">Are you sure you want to delete this Song?</div>
<div className="flex justify-end"> <div className="flex justify-end">
<button <button
onClick={handleCancel}
className="px-4 py-2 mr-2 bg-gray-300 hover:bg-gray-400 rounded" className="px-4 py-2 mr-2 bg-gray-300 hover:bg-gray-400 rounded"
> >
Batal Cancel
</button> </button>
<button <button
onClick={handleDeleteSong}
className="px-4 py-2 bg-red-500 hover:bg-red-600 text-white rounded" className="px-4 py-2 bg-red-500 hover:bg-red-600 text-white rounded"
> >
Hapus Delete
</button> </button>
</div> </div>
</div> </div>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment