Handle errors in instance listing

This commit is contained in:
Chocobozzz 2018-03-15 16:36:41 +01:00
parent 651c10260f
commit 90c239ef66
No known key found for this signature in database
GPG key ID: 583A612D890159BE
3 changed files with 18 additions and 12 deletions

View file

@ -119,7 +119,8 @@ or the entire fediverse.
Liste des instances
<div id="instances-list" class="list-group"></div>
<div class="alert alert-info">This is like picking an e-mail hosting provider: the domain will also be part of your username!</div>
<div id="instances-list-error" class="alert alert-danger" style="display: none">We are sorry but we failed to list available instances. Please try again later.</div>
<div class="alert alert-info">This is like picking an e-mail hosting provider: the domain will be part of your username!</div>
{{% /grid %}}

View file

@ -119,7 +119,8 @@ Liste des instances
<div id="instances-list" class="list-group"></div>
<div class="alert alert-info">This is like picking an e-mail hosting provider: the domain will also be part of your username!</div>
<div id="instances-list-error" class="alert alert-danger" style="display: none">Nous sommes désolé mais nous n'arrivons pas à récupérer la liste des instances. Merci de réessayer plus tard.</div>
<div class="alert alert-info">C'est comme choisir un fournisseur d'email : le nom de domaine fera partie de votre identifiant !</div>
{{% /grid %}}
{{% /grid %}}

View file

@ -6,8 +6,10 @@ $(function () {
signup: true,
healthy: true
}
const instancesListElement = $('#instances-list')
$.get(instancesApi, data, function (res) {
$.get(instancesApi, data)
.done(function (res) {
const instances = res.data
const lis = []
@ -16,8 +18,10 @@ $(function () {
lis.push(el)
})
$('#instances-list').append(lis)
instancesListElement.append(lis)
})
.fail(function (err) {
$('#instances-list-error').css('display', 'block')
})
function createInstanceElement (host, name, description) {