mirror of
https://github.com/C9Glax/tranga-website.git
synced 2025-10-11 21:29:50 +02:00
28 lines
1002 B
Vue
28 lines
1002 B
Vue
<template>
|
|
<UPageList class="gap-2">
|
|
<UPageCard
|
|
v-for="l in fileLibraries"
|
|
variant="soft"
|
|
icon="i-lucide-library-big"
|
|
:title="l.libraryName"
|
|
:description="l.basePath"
|
|
orientation="horizontal">
|
|
<UButton color="warning" :loading="busy" @click="deleteLibrary(l)">Delete</UButton>
|
|
</UPageCard>
|
|
</UPageList>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import type { components } from '#open-fetch-schemas/api';
|
|
type FileLibrary = components['schemas']['FileLibrary'];
|
|
const { data: fileLibraries } = await useApi('/v2/FileLibrary', { key: FetchKeys.FileLibraries });
|
|
|
|
const busy = ref(false);
|
|
const deleteLibrary = async (library: FileLibrary) => {
|
|
busy.value = true;
|
|
await useApi('/v2/FileLibrary/{FileLibraryId}', { path: { FileLibraryId: library.key }, method: 'DELETE' })
|
|
.then(() => refreshNuxtData(FetchKeys.FileLibraries))
|
|
.finally(() => (busy.value = false));
|
|
};
|
|
</script>
|