Fix domain-server settings "Create new domain ID" dialog.

This commit is contained in:
Kalila L 2020-10-27 01:22:47 -04:00
parent c2570c2ae7
commit 6232aba63e

View file

@ -375,7 +375,7 @@ $(document).ready(function(){
}
} else {
// we're going to change the alert to a new one with a spinner while we create this domain
showSpinnerAlert('Creating domain ID');
// showSpinnerAlert('Creating domain ID');
createNewDomainID(inputValue, justConnected);
}
});
@ -388,6 +388,11 @@ $(document).ready(function(){
}
$.post("/api/domains", domainJSON, function(data) {
if (data.status === "failure") {
failedToCreateDomainID(data, justConnected);
return;
}
// we successfully created a domain ID, set it on that field
var domainID = data.domain.domainId;
console.log("Setting domain id to ", data, domainID);
@ -411,10 +416,21 @@ $(document).ready(function(){
}, function() {
saveSettings();
});
}, 'json').fail(function(){
}, 'json').fail(function(data) {
failedToCreateDomainID(data, justConnected);
});
}
function failedToCreateDomainID (data, justConnected) {
var errorText = "There was a problem creating your new domain ID. Do you want to try again or";
if (data && data.status === "failure") {
errorText = "Error: " + data.error + "</br>Do you want to try again or";
console.log("Error: " + data.error);
} else {
console.log("Error: Failed to post to metaverse.");
}
if (justConnected) {
errorText += " just save your new access token?</br></br>You can always create a new domain ID later.";
} else {
@ -442,7 +458,6 @@ $(document).ready(function(){
}
}
});
});
}
function createDomainSpinner() {