summaryrefslogtreecommitdiff
path: root/dist/callback.html
diff options
context:
space:
mode:
authorDennis Kobert <dennis@kobert.dev>2020-02-11 17:58:07 +0000
committerDennis Kobert <dennis@kobert.dev>2020-02-11 17:58:07 +0000
commitca3f3051a9552e372ef466f1eba36c9ea9b6c314 (patch)
treea329fd5737d77ae51f65b2a20ce4b4b49aa2b51c /dist/callback.html
parent4c3cd7f8025209a8e95bc1d598e35a23cbcd945e (diff)
Add callback html
Diffstat (limited to 'dist/callback.html')
-rw-r--r--dist/callback.html25
1 files changed, 25 insertions, 0 deletions
diff --git a/dist/callback.html b/dist/callback.html
new file mode 100644
index 0000000..002515c
--- /dev/null
+++ b/dist/callback.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <h1>Spotify Intersect</h1>
+ <button onclick="load_songs()">Load songs to database</button>
+ <script>
+ function getParameterByName(name) {
+ let url = window.location.href;
+ name = name.replace(/[\[\]]/g, "\\$&");
+ var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
+ results = regex.exec(url);
+ if (!results) return null;
+ if (!results[2]) return '';
+ return decodeURIComponent(results[2].replace(/\+/g, " "));
+ }
+
+ function load_songs() {
+ console.log("loading songs");
+ let token = sessionStorage.getItem('token');
+ fetch("https://kobert.dev/spotify-api/callback/" + token + "/" + getParameterByName("code")).then(console.log("finished loading songs!"));
+ //window.location = "https://kobert.dev/spotify-api/token/" + token;
+ }
+ </script>
+</body>
+</html>