mirror of
https://github.com/uqbar-dao/nectar.git
synced 2025-01-03 06:11:01 +03:00
app_store: make widget retry every second if initial fetch fails
This commit is contained in:
parent
31f73db0b0
commit
85f22776f1
@ -139,10 +139,12 @@ fn make_widget() -> String {
|
||||
<div id="latest-apps"></div>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
function fetchApps() {
|
||||
fetch('/main:app_store:sys/apps', { credentials: 'include' })
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
const container = document.getElementById('latest-apps');
|
||||
container.innerHTML = '';
|
||||
data.forEach(app => {
|
||||
if (app.metadata) {
|
||||
const a = document.createElement('a');
|
||||
@ -165,7 +167,13 @@ fn make_widget() -> String {
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(error => console.error('Error fetching apps:', error));
|
||||
.catch(error => {
|
||||
console.error('Error fetching apps:', error);
|
||||
setTimeout(fetchApps, 1000); // Retry after a second
|
||||
});
|
||||
}
|
||||
|
||||
fetchApps();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user