42 lines
743 B
JavaScript
42 lines
743 B
JavaScript
/**
|
|
* Page archives : animaux décédés.
|
|
*/
|
|
|
|
async function chargerArchives()
|
|
{
|
|
const animaux = await appelerApi("/api/animaux?archives=oui");
|
|
|
|
if (!animaux)
|
|
{
|
|
return;
|
|
}
|
|
|
|
const liste = document.getElementById("listeArchives");
|
|
const messageVide = document.getElementById("messageVide");
|
|
|
|
if (animaux.length === 0)
|
|
{
|
|
liste.innerHTML = "";
|
|
messageVide.hidden = false;
|
|
return;
|
|
}
|
|
|
|
messageVide.hidden = true;
|
|
liste.innerHTML = animaux.map(htmlCarteAnimal).join("");
|
|
}
|
|
|
|
async function demarrer()
|
|
{
|
|
const utilisateur = await verifierSession();
|
|
|
|
if (!utilisateur)
|
|
{
|
|
return;
|
|
}
|
|
|
|
brancherDeconnexion();
|
|
await chargerArchives();
|
|
}
|
|
|
|
demarrer();
|