fixed link in client get requests
This commit is contained in:
parent
58cb05d2dc
commit
279a44d760
1 changed files with 10 additions and 5 deletions
|
@ -46,20 +46,25 @@
|
||||||
const failureMessage = document.getElementById('failure-message');
|
const failureMessage = document.getElementById('failure-message');
|
||||||
searchMessage.hidden = true;
|
searchMessage.hidden = true;
|
||||||
failureMessage.hidden = false;
|
failureMessage.hidden = false;
|
||||||
failureMessage.innerText(msg);
|
failureMessage.innerText = msg;
|
||||||
},
|
},
|
||||||
checkClaimAvailability: function (claimName, claimId) {
|
checkClaimAvailability: function (claimName, claimId) {
|
||||||
console.log(`getting ${claimName}#${claimId}}`)
|
console.log(`getting ${claimName}#${claimId}}`)
|
||||||
var uri = `/api/get/${claimName}/${claimId}`;
|
var uri = `/api/local/${claimName}/${claimId}`;
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
var that = this;
|
var that = this;
|
||||||
xhr.open("GET", uri, true);
|
xhr.open("GET", uri, true);
|
||||||
xhr.onreadystatechange = function() {
|
xhr.onreadystatechange = function() {
|
||||||
if (xhr.readyState == 4) {
|
if (xhr.readyState == 4) {
|
||||||
const response = JSON.parse(xhr.response);
|
const response = JSON.parse(xhr.response);
|
||||||
if (xhr.status == 200 && response.message === false) {
|
if (xhr.status == 200) {
|
||||||
that.showSearchMessage();
|
if (response.message === false) {
|
||||||
that.getAsset(claimName, claimId)
|
that.showSearchMessage();
|
||||||
|
that.getAsset(claimName, claimId)
|
||||||
|
} else {
|
||||||
|
console.log('local asset is available on spee.ch')
|
||||||
|
that.showAsset();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log('get failed:', response);
|
console.log('get failed:', response);
|
||||||
that.showFailureMessage('Well this sucks, but we can\'t seem to phone home');
|
that.showFailureMessage('Well this sucks, but we can\'t seem to phone home');
|
||||||
|
|
Loading…
Reference in a new issue