From a09c4a1304d2697231aacf520357c6f21dfb9784 Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Sat, 22 Feb 2020 20:04:01 +0100 Subject: Unify button and callback.html --- dist/callback.html | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dist/callback.html b/dist/callback.html index 8f46292..ec2e584 100644 --- a/dist/callback.html +++ b/dist/callback.html @@ -61,7 +61,8 @@ body {

Spotify Intersect

- + +

@@ -80,6 +81,13 @@ body { if (!results[2]) return ''; return decodeURIComponent(results[2].replace(/\+/g, " ")); } + function connect_button() { + //http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript + let token = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); + sessionStorage.setItem('token', token); + document.getElementById("Connect_button").disabled = true; + window.location = "https://kobert.dev/spotify-api/token/" + token; + } function load_songs() { console.log("loading songs"); @@ -112,6 +120,10 @@ function match_users() { }); } function populate_users() { + if (getParameterByName("code") != null) { + document.getElementById("Connect_button").disabled = true; + document.getElementById("Load_button").disabled = false; + } fetch("https://kobert.dev/spotify-api/user") .then(function(response) { if (!response.ok) { -- cgit v1.2.3-54-g00ecf