fix current directory not updating when modifying stuff
This commit is contained in:
@@ -61,7 +61,7 @@ async function onClick() {
|
||||
<ContextMenu>
|
||||
<ContextMenuTrigger>
|
||||
<button
|
||||
:disabled="warrenStore.loading"
|
||||
:disabled="warrenStore.loading || disabled"
|
||||
:class="[
|
||||
'bg-accent/30 border-border flex w-52 flex-row gap-4 overflow-hidden rounded-md border-1 px-4 py-2 select-none',
|
||||
{
|
||||
|
||||
9
frontend/composables/useWarrenPath.ts
Normal file
9
frontend/composables/useWarrenPath.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export function useWarrenPath() {
|
||||
const store = useWarrenStore();
|
||||
|
||||
if (store.current == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return `${store.current.warrenId}/${store.current.path}`;
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import { toast } from 'vue-sonner';
|
||||
import type { ApiResponse } from '~/types/api';
|
||||
import { getAuthSessionData } from './getSession';
|
||||
import type { AuthUser } from '~/types/auth';
|
||||
|
||||
export async function loginUser(
|
||||
|
||||
@@ -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,7 +17,9 @@ if (warrenStore.current == null) {
|
||||
});
|
||||
}
|
||||
|
||||
const entries = computedAsync<DirectoryEntry[]>(async () => {
|
||||
const entries = useAsyncData(
|
||||
'current-directory',
|
||||
async () => {
|
||||
if (warrenStore.current == null) {
|
||||
return [];
|
||||
}
|
||||
@@ -35,7 +36,9 @@ const entries = computedAsync<DirectoryEntry[]>(async () => {
|
||||
loadingIndicator.finish();
|
||||
|
||||
return entries;
|
||||
}, []);
|
||||
},
|
||||
{ watch: [warrenPath] }
|
||||
).data;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user