man kann "kein gerät" auswählen

pull/46/head
eric 2025-08-12 02:59:22 +02:00
parent f53bafb918
commit 257e10c3b3
2 changed files with 12 additions and 2 deletions

View File

@ -18,6 +18,13 @@ area.appendChild(select);
async function loadDevices() {
select.innerHTML = "";
// Standardoption "Kein Gerät"
const noneOpt = document.createElement("option");
noneOpt.value = "";
noneOpt.textContent = "Kein Gerät";
select.appendChild(noneOpt);
const devices = await fetchJson(`/api/spotify/devices?username=${encodeURIComponent(username)}`);
if (!devices.length) {
const opt = document.createElement("option");
@ -34,6 +41,8 @@ async function loadDevices() {
select.appendChild(opt);
});
select.disabled = false;
select.value = ""; // "Kein Gerät" als Standard
}
loadDevices();

View File

@ -316,8 +316,9 @@ function handleGameEnd({ winner }) {
// Spotify-Playback Funktion (unverändert)
async function playOnSpotify(trackUri, username) {
const deviceId = document.getElementById("deviceSelect")?.value;
if (!deviceId) {
alert("Bitte ein Wiedergabegerät auswählen!");
if (deviceId === "") {
//alert("Bitte ein Wiedergabegerät auswählen!");
//keine warnung i guess
return;
}
try {