<!doctype html>
<meta charset="utf-8" />
<style>
body {
background: #555;
color: #fff;
font-family: monospace;
font-size: 18px;
}
.message {
background: #333;
border: 1px solid #666;
border-radius: 0.5em;
margin: 20vh auto 2em;
padding: 1em;
max-width: 23em;
}
h3 {
color: #bfd;
}
</style>
<body>
<div class="message">
<h3>Authorized</h3>
<p>Exchanging auth token for access token<span class="dots">.</span></p>
<p class="status"> </p>
</div>
<script type="text/javascript">
var done = (dotsEl => {
const another = () => dotsEl.textContent += '.';
const timer = setInterval(another, 300);
return () => clearInterval(timer);
})(document.querySelector('.dots'));
var statusEl = document.querySelector('.status');
fetch('/token-status')
.then(
response => {
statusEl.textContent = response.ok
? "Success!"
: "Hmm, Looks like something went wrong in the exchange.";
},
error => {
console.error({ error });
statusEl.textContent = "Something went wrong while waiting. Check the terminal.";
})
.then(done);
</script>
</body>