Skip to content

Commit

Permalink
fix: change all devices at the same time
Browse files Browse the repository at this point in the history
  • Loading branch information
darlanalves authored Aug 13, 2023
1 parent 61515a0 commit 89b0ecc
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 89b0ecc

Please sign in to comment.