fix loading indicator for traversing warrens
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
<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'],
|
||||
});
|
||||
|
||||
const warrenStore = useWarrenStore();
|
||||
const loadingIndicator = useLoadingIndicator();
|
||||
|
||||
if (warrenStore.current == null) {
|
||||
await navigateTo({
|
||||
@@ -15,16 +18,24 @@ if (warrenStore.current == null) {
|
||||
});
|
||||
}
|
||||
|
||||
const entries = useAsyncData('current-directory', async () => {
|
||||
const entries = computedAsync<DirectoryEntry[]>(async () => {
|
||||
if (warrenStore.current == null) {
|
||||
return null;
|
||||
return [];
|
||||
}
|
||||
|
||||
return await getWarrenDirectory(
|
||||
loadingIndicator.start();
|
||||
warrenStore.loading = true;
|
||||
|
||||
const entries = await getWarrenDirectory(
|
||||
warrenStore.current.warrenId,
|
||||
warrenStore.current.path
|
||||
);
|
||||
}).data;
|
||||
|
||||
warrenStore.loading = false;
|
||||
loadingIndicator.finish();
|
||||
|
||||
return entries;
|
||||
}, []);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user