Add loading store to Navigator to keep track of loading state
This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
<script>
|
||||
import { fs_rename, fs_update } from "../FilesystemAPI";
|
||||
import Modal from "../../util/Modal.svelte";
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import BrandingOptions from "./BrandingOptions.svelte";
|
||||
import { branding_from_node } from "./Branding";
|
||||
import FileOptions from "./FileOptions.svelte";
|
||||
import SharingOptions from "./SharingOptions.svelte";
|
||||
|
||||
let dispatch = createEventDispatcher()
|
||||
|
||||
export let nav
|
||||
let file = {
|
||||
path: "",
|
||||
@@ -78,7 +75,7 @@ const save = async (keep_editing = false) => {
|
||||
|
||||
let new_file
|
||||
try {
|
||||
dispatch("loading", true)
|
||||
nav.set_loading(true)
|
||||
let opts = {shared: shared}
|
||||
|
||||
opts.branding_enabled = branding_enabled ? "true" : ""
|
||||
@@ -113,7 +110,7 @@ const save = async (keep_editing = false) => {
|
||||
}
|
||||
return
|
||||
} finally {
|
||||
dispatch("loading", false)
|
||||
nav.set_loading(false)
|
||||
}
|
||||
|
||||
if (open_after_edit) {
|
||||
@@ -154,7 +151,6 @@ const save = async (keep_editing = false) => {
|
||||
bind:new_name
|
||||
bind:visible
|
||||
bind:open_after_edit
|
||||
on:loading
|
||||
/>
|
||||
{:else if tab === "share"}
|
||||
<SharingOptions
|
||||
|
@@ -1,10 +1,8 @@
|
||||
<script>
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import Button from "../../layout/Button.svelte";
|
||||
import { fs_delete_all } from "../FilesystemAPI";
|
||||
import PathLink from "../util/PathLink.svelte";
|
||||
|
||||
let dispatch = createEventDispatcher()
|
||||
export let nav
|
||||
export let file = {}
|
||||
export let new_name
|
||||
@@ -17,14 +15,14 @@ const delete_file = async e => {
|
||||
e.preventDefault()
|
||||
|
||||
try {
|
||||
dispatch("loading", true)
|
||||
nav.set_loading(true)
|
||||
await fs_delete_all(file.path)
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
alert(err)
|
||||
return
|
||||
} finally {
|
||||
dispatch("loading", false)
|
||||
nac.set_loading(false)
|
||||
}
|
||||
|
||||
if (open_after_edit) {
|
||||
|
Reference in New Issue
Block a user