mirror of
https://github.com/ivabus/www
synced 2024-11-22 08:25:12 +03:00
Add a 'no jobs available' if not jobs in breezy.
This commit is contained in:
parent
353ac32766
commit
722cf08c35
1 changed files with 73 additions and 63 deletions
|
@ -32,6 +32,15 @@
|
|||
fetch("https://tea.breezy.hr/json?verbose=true")
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
// Check if data is empty
|
||||
if (data.length === 0) {
|
||||
// Display message when no jobs are available
|
||||
const container = document.getElementById("card-container");
|
||||
const noJobsMessage = document.createElement("div");
|
||||
noJobsMessage.classList.add("alert", "alert-info");
|
||||
noJobsMessage.textContent = "No jobs available right now";
|
||||
container.appendChild(noJobsMessage);
|
||||
} else {
|
||||
// Loop through data and create card for each item
|
||||
data.forEach(item => {
|
||||
// Create card element
|
||||
|
@ -92,6 +101,7 @@
|
|||
row.appendChild(col);
|
||||
container.appendChild(row);
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(error => console.log(error));
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue