28 lines
729 B
TypeScript
28 lines
729 B
TypeScript
"use client";
|
|
|
|
import { Screens } from "@/components/AllSongsTable";
|
|
|
|
export default function SenderPage() {
|
|
const sendSong = async (title: string, bookTitle: string, number: string) => {
|
|
try {
|
|
const res = await fetch("/api/stream", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify({ song: title, songBook: bookTitle, number }),
|
|
});
|
|
if (!res.ok) {
|
|
alert("Fehler beim Senden.");
|
|
}
|
|
} catch (error) {
|
|
console.error("Failed sending current song:", error);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<Screens.Songs
|
|
actionName="Anzeigen"
|
|
onSelectSong={(song, book, number) => sendSong(song.title, book.title, number)}
|
|
/>
|
|
);
|
|
}
|