summaryrefslogtreecommitdiff
path: root/dist/callback.html
diff options
context:
space:
mode:
Diffstat (limited to 'dist/callback.html')
-rw-r--r--dist/callback.html20
1 files changed, 10 insertions, 10 deletions
diff --git a/dist/callback.html b/dist/callback.html
index 79ac83c..555bede 100644
--- a/dist/callback.html
+++ b/dist/callback.html
@@ -78,18 +78,17 @@
<button id="Connect_button" onclick="connect_button()">Connect to Spotify</button>
<button id="Load_button" onclick="load_songs()" disabled=true>Load songs to database</button>
<p id="status"></p>
- <input type="text" id="name1" placeholder="First name">
- <input type="text" id="name2" placeholder="Second name">
+ <input type="text" id="names" placeholder="Comma seperated list of usernames">
<button id="Match_button" onclick="match_users()">Match users</button>
</div>
<div class="out">
<p id="output"></p>
</div>
<script>
- const host = "http://127.0.0.1:8000";
- const api = host + "";
- //const host = "https://kobert.dev";
- //const api = host + "/spotify-api";
+ //const host = "http://127.0.0.1:8000";
+ //const api = host + "";
+ const host = "https://kobert.dev";
+ const api = host + "/spotify-api";
let lobby = null;
function getParameterByName(name) {
let url = window.location.href;
@@ -117,14 +116,16 @@
if (code !== null) {
document.getElementById("Connect_button").disabled = true;
document.getElementById("Load_button").disabled = false;
+ document.getElementById("username").disabled = false;
}
if (lobby === null) {
document.getElementById("status").innerHTML = `Error: this is no valid lobby, please create a lobby first`;
document.getElementById("Connect_button").disabled = true;
document.getElementById("Load_button").disabled = true;
+ document.getElementById("username").disabled = true;
return;
}
- fetch(api + "/user/" + lobby)
+ fetch(api + "/users/" + lobby)
.then(function (response) {
if (!response.ok) {
document.getElementById("status").innerHTML = `Error occured while loading songs: ${response.status}`;
@@ -152,10 +153,9 @@
//window.location = api + "/token/" + token;
}
function match_users() {
- let name1 = document.getElementById("name1").value;
- let name2 = document.getElementById("name2").value;
+ let names = document.getElementById("names").value;
- fetch(api + `/match/${lobby}/${name1},${name2}`)
+ fetch(api + `/match/${lobby}/${names}`)
.then(function (response) {
if (!response.ok) {
document.getElementById("status").innerHTML = `Error occured while loading songs: ${response.status}`;