diff --git a/components/admin/AdminStorageItem.vue b/components/admin/AdminStorageItem.vue index 1ba948860..9c65d2a0c 100644 --- a/components/admin/AdminStorageItem.vue +++ b/components/admin/AdminStorageItem.vue @@ -9,20 +9,30 @@ const props = defineProps<{ const chunk = computed(() => props.itemKey.replace(/^.+:/, '')); +const isOpen = ref(false); + const contentUrl = computed(() => `/api/admin/storage/items/${props.itemKey}`); const contentAsyncData = useFetch(contentUrl.value, { immediate: false, }); +watch(isOpen, async () => { + if (isOpen.value) { + await contentAsyncData.execute(); + } +}); + const adminStorageRefresh = inject(adminStorageRefreshInjectionKey); const dialogue = useDialogue(); const remove = async () => { try { await dialogue.confirm(`Are you sure you want to remove ${props.itemKey}?`, 'danger'); } catch (error) { - console.error(error); - return; + if (error === undefined) { + return; + } + throw error; } await $fetch(contentUrl.value, { method: 'DELETE' }); if (adminStorageRefresh) { @@ -32,7 +42,7 @@ const remove = async () => {