Clean up and better error checking

This commit is contained in:
2021-09-26 12:48:42 +09:30
parent 2c57a77b98
commit 7c1d11298f
2 changed files with 17 additions and 6 deletions

View File

@@ -18,7 +18,7 @@
<tr>
<td x-text="item.id"></td>
<td x-text="item.files"></td>
<td x-text="item.url"></td>
<td><a x-bind:href="item.url">link</a></td>
<td x-text="item.state"></td>
<td x-text="item.percent"></td>
<td x-text="item.eta"></td>
@@ -44,7 +44,10 @@
fetch('/fetch/info')
.then(response => response.json())
.then(info => {
this.items = info;
// will be null if no downloads yet
if (info) {
this.items = info;
}
setTimeout(() => { this.fetch_data() }, 1000);
})
},