telebit-relay.js/lib/extensions/admin/login/js/app.js

24 lines
737 B
JavaScript
Raw Normal View History

2018-06-15 08:45:47 +00:00
(function () {
'use strict';
var magic = (window.location.hash || '').substr(2).replace(/magic=/, '');
if (magic) {
window.fetch('https://api.' + location.hostname + '/api/telebit.cloud/magic/' + magic, {
method: 'GET'
, cors: true
}).then(function (resp) {
return resp.json().then(function (json) {
document.querySelector('body').hidden = false;
document.querySelector('js-magic').hidden = false;
document.querySelector('js-token-data').innerText = JSON.stringify(json, null, 2);
document.querySelector('js-new-href').href = json.domains[0];
document.querySelector('js-new-href').innerText = json.domains[0];
});
});
} else {
document.querySelector('body').hidden = false;
}
}());