From 89b0eccb05c447f2bbcefa57afbf561f70b5ca94 Mon Sep 17 00:00:00 2001 From: Darlan Alves Date: Sun, 13 Aug 2023 19:38:39 +0200 Subject: [PATCH] fix: change all devices at the same time --- index.html | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index c84e034..c5259cb 100644 --- a/index.html +++ b/index.html @@ -97,14 +97,12 @@ theme.content = color; const { clientId, clientSecret, deviceIds } = await getProperties(); - const deviceId = - deviceIds[ - 1 + (Math.floor(Math.random() * 1000) % deviceIds.length) - 1 - ]; - fetch("/tap/" + deviceId + "/" + colorString, { - headers: { clientId, clientSecret }, - }); + deviceIds.forEach((deviceId) => + fetch("/tap/" + deviceId + "/" + colorString, { + headers: { clientId, clientSecret }, + }) + ); } main.onclick = changeColor;