Add loading store to Navigator to keep track of loading state
This commit is contained in:
@@ -52,7 +52,7 @@ export const toggle_playback = () => {
|
||||
<Spinner></Spinner>
|
||||
</div>
|
||||
{:else if viewer_type === "dir"}
|
||||
<FileManager nav={nav} edit_window={edit_window} on:loading on:upload_picker>
|
||||
<FileManager nav={nav} edit_window={edit_window} on:upload_picker>
|
||||
<CustomBanner path={$nav.path}/>
|
||||
</FileManager>
|
||||
{:else if viewer_type === "audio"}
|
||||
@@ -70,11 +70,11 @@ export const toggle_playback = () => {
|
||||
<CustomBanner path={$nav.path}/>
|
||||
</Text>
|
||||
{:else if viewer_type === "torrent"}
|
||||
<Torrent nav={nav} bind:this={viewer} on:loading on:download>
|
||||
<Torrent nav={nav} bind:this={viewer} on:download>
|
||||
<CustomBanner path={$nav.path}/>
|
||||
</Torrent>
|
||||
{:else if viewer_type === "zip"}
|
||||
<Zip nav={nav} bind:this={viewer} on:loading on:download>
|
||||
<Zip nav={nav} bind:this={viewer} on:download>
|
||||
<CustomBanner path={$nav.path}/>
|
||||
</Zip>
|
||||
{:else}
|
||||
|
@@ -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 = {
|
||||
|
@@ -21,8 +21,6 @@ let comp_ratio = 0
|
||||
let archive_type = ""
|
||||
|
||||
export const update = async () => {
|
||||
dispatch("loading", true)
|
||||
|
||||
if (nav.base.file_type === "application/zip") {
|
||||
archive_type = "zip"
|
||||
} else if (nav.base.file_type === "application/x-7z-compressed") {
|
||||
@@ -30,6 +28,7 @@ export const update = async () => {
|
||||
}
|
||||
|
||||
try {
|
||||
nav.set_loading(true)
|
||||
let resp = await fetch(fs_path_url(nav.base.path)+"?zip_info")
|
||||
|
||||
if (resp.status >= 400) {
|
||||
@@ -51,10 +50,9 @@ export const update = async () => {
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
} finally {
|
||||
dispatch("loading", false)
|
||||
nav.set_loading(false)
|
||||
status = "finished"
|
||||
}
|
||||
|
||||
status = "finished"
|
||||
}
|
||||
|
||||
const recursive_set_url = (parent_path, file) => {
|
||||
|
Reference in New Issue
Block a user