mirror of
https://github.com/C9Glax/tranga-website.git
synced 2025-10-11 21:29:50 +02:00
nuxt rewrite
This commit is contained in:
31
website/app/components/FileLibraries.vue
Normal file
31
website/app/components/FileLibraries.vue
Normal file
@@ -0,0 +1,31 @@
|
||||
<template>
|
||||
<UPageList divide>
|
||||
<UPageCard
|
||||
v-for="l in fileLibraries"
|
||||
variant="ghost"
|
||||
icon="i-lucide-library-big"
|
||||
:title="l.libraryName"
|
||||
:description="l.basePath"
|
||||
orientation="horizontal">
|
||||
<UButton color="warning" @click="deleteLibrary(l)" :loading="busy">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, refresh } = useApi('/v2/FileLibrary');
|
||||
|
||||
const config = useRuntimeConfig();
|
||||
const busy = ref(false);
|
||||
const deleteLibrary = (l: FileLibrary) => {
|
||||
busy.value = true;
|
||||
$fetch(new Request(`${config.public.openFetch.api.baseURL}v2/FileLibrary/${l.key}`), { method: 'DELETE' }).finally(
|
||||
() => {
|
||||
refresh();
|
||||
busy.value = false;
|
||||
}
|
||||
);
|
||||
};
|
||||
</script>
|
Reference in New Issue
Block a user