Add loading store to Navigator to keep track of loading state

This commit is contained in:
2024-08-09 13:47:10 +02:00
parent 69744e41a6
commit 12e23b3872
11 changed files with 51 additions and 86 deletions

View File

@@ -15,9 +15,8 @@ export let nav
let status = "loading"
export const update = async () => {
dispatch("loading", true)
try {
nav.set_loading(true)
let resp = await fetch(fs_path_url(nav.base.path)+"?torrent_info")
if (resp.status >= 400) {
@@ -44,9 +43,9 @@ export const update = async () => {
} catch (err) {
console.error(err)
} finally {
dispatch("loading", false)
nav.set_loading(false)
status = "finished"
}
status = "finished"
}
let torrent = {