Skip to content

Commit

Permalink
fix: File manager refresh (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
skarab42 committed Feb 11, 2021
1 parent 57b01f2 commit 9610902
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions front-src/client/components/FileManager/FileList.svelte
@@ -1,9 +1,9 @@
<script>
import api from "@/api/files";
import { _ } from "@/libs/i18next";
import { store } from "@/stores/files";
import { fade } from "svelte/transition";
import { createEventDispatcher } from "svelte";
import { createEventDispatcher, onMount } from "svelte";
import { store, refresh } from "@/stores/files";
import Button from "@/components/UI/Button.svelte";
import FileIcon from "@/components/UI/FileIcon.svelte";
import MdDelete from "svelte-icons/md/MdDeleteForever.svelte";
Expand Down Expand Up @@ -39,6 +39,8 @@
function bgImage(file) {
return `background-image: url(files/${file.filename});`;
}
onMount(() => refresh());
</script>

{#each files as file}
Expand Down
6 changes: 5 additions & 1 deletion front-src/client/stores/files.js
Expand Up @@ -20,7 +20,11 @@ function loadOnce() {
loaded = true;
}

export default async function load() {
export async function refresh() {
store.set(await api.getFileList());
}

export default async function load() {
refresh();
loadOnce();
}

0 comments on commit 9610902

Please sign in to comment.