man kann "kein gerät" auswählen
parent
f53bafb918
commit
257e10c3b3
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue