better error handling
This commit is contained in:
parent
5aed381963
commit
79e9728d19
|
@ -9,7 +9,7 @@
|
|||
<div class="js-error" hidden>
|
||||
<h1>Invalid Magic Link</h1>
|
||||
<div class="js-magic-link">'{{magic_link}}' isn't a valid magic link code.
|
||||
<br>Links are only good for 5 minutes, so you gotta act fast.
|
||||
<br>Links are only valid for a limited time, so you gotta act fast.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -53,11 +53,17 @@ function submitCode(pair) {
|
|||
// shouldn't be pending (because we get here by being ready)
|
||||
// should poll over 'ready'
|
||||
|
||||
console.log('Submit Code Response:');
|
||||
console.log(data);
|
||||
if (data.error) {
|
||||
document.querySelector('.js-error').hidden = false;
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout(checkStatus, 0);
|
||||
|
||||
document.querySelector('.js-authz').hidden = false;
|
||||
console.log(data);
|
||||
|
||||
/*
|
||||
document.querySelectorAll('.js-token-data').forEach(function ($el) {
|
||||
$el.innerText = JSON.stringify(data, null, 2);
|
||||
|
@ -90,6 +96,7 @@ function init() {
|
|||
if (!magic) {
|
||||
document.querySelector('body').hidden = false;
|
||||
document.querySelector('.js-error').hidden = false;
|
||||
return;
|
||||
}
|
||||
|
||||
window.fetch(meta.baseUrl + meta.pair_request.pathname + '/' + magic, {
|
||||
|
@ -97,7 +104,7 @@ function init() {
|
|||
, cors: true
|
||||
}).then(function (resp) {
|
||||
return resp.json().then(function (data) {
|
||||
console.log('Data:');
|
||||
console.log('pair request:');
|
||||
console.log(data);
|
||||
document.querySelector('body').hidden = false;
|
||||
if (data.error) {
|
||||
|
|
Loading…
Reference in New Issue