"use client"
import { deleteBoard } from "@/app/actions/boardActions"
import { useRouter } from "next/navigation";


const BoardDelete = ({boardId}:{boardId:string}) => {
    const router = useRouter();
    async function handleDeleteBoard(){
        await deleteBoard(boardId);
        router.push('/');
    }



  return (
    <div>
        <button onClick={() => handleDeleteBoard()} className="bg-[tomato] p-2 text-white rounded-md font-semibold hover:opacity-90">Delete board</button>
    </div>
    
  )
}

export default BoardDelete