fix current directory not updating when modifying stuff
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computedAsync } from '@vueuse/core';
|
||||
import DirectoryListContextMenu from '~/components/DirectoryListContextMenu.vue';
|
||||
import RenameEntryDialog from '~/components/actions/RenameEntryDialog.vue';
|
||||
import { getWarrenDirectory } from '~/lib/api/warrens';
|
||||
import type { DirectoryEntry } from '~/types';
|
||||
|
||||
definePageMeta({
|
||||
middleware: ['authenticated'],
|
||||
@@ -11,6 +9,7 @@ definePageMeta({
|
||||
|
||||
const warrenStore = useWarrenStore();
|
||||
const loadingIndicator = useLoadingIndicator();
|
||||
const warrenPath = computed(() => useWarrenPath());
|
||||
|
||||
if (warrenStore.current == null) {
|
||||
await navigateTo({
|
||||
@@ -18,24 +17,28 @@ if (warrenStore.current == null) {
|
||||
});
|
||||
}
|
||||
|
||||
const entries = computedAsync<DirectoryEntry[]>(async () => {
|
||||
if (warrenStore.current == null) {
|
||||
return [];
|
||||
}
|
||||
const entries = useAsyncData(
|
||||
'current-directory',
|
||||
async () => {
|
||||
if (warrenStore.current == null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
loadingIndicator.start();
|
||||
warrenStore.loading = true;
|
||||
loadingIndicator.start();
|
||||
warrenStore.loading = true;
|
||||
|
||||
const entries = await getWarrenDirectory(
|
||||
warrenStore.current.warrenId,
|
||||
warrenStore.current.path
|
||||
);
|
||||
const entries = await getWarrenDirectory(
|
||||
warrenStore.current.warrenId,
|
||||
warrenStore.current.path
|
||||
);
|
||||
|
||||
warrenStore.loading = false;
|
||||
loadingIndicator.finish();
|
||||
warrenStore.loading = false;
|
||||
loadingIndicator.finish();
|
||||
|
||||
return entries;
|
||||
}, []);
|
||||
return entries;
|
||||
},
|
||||
{ watch: [warrenPath] }
|
||||
).data;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user