Use nuxtopenfetch

This commit is contained in:
2025-10-10 20:13:29 +02:00
parent 1bce60af7d
commit 48d355d657
19 changed files with 2039 additions and 1660 deletions

View File

@@ -15,20 +15,22 @@
</template>
<script setup lang="ts">
import type { ApiModel } from '#nuxt-api-party';
import type { components } from '#open-fetch-schemas/api';
type CreateLibraryRecord = components['schemas']['CreateLibraryRecord'];
const name = ref('');
const path = ref('');
const model = computed((): ApiModel<'CreateLibraryRecord'> => {
const model: ComputedRef = computed((): CreateLibraryRecord => {
return { basePath: path.value, libraryName: name.value };
});
const busy = ref(false);
const onAddClick = async () => {
if (!model.value) return;
busy.value = true;
await $api('/v2/FileLibrary', { method: 'PUT', body: model.value })
.then(() => refreshNuxtData(Keys.FileLibraries))
await useApi('/v2/FileLibrary', { method: 'PUT', body: model.value })
.then(() => refreshNuxtData(FetchKeys.FileLibraries))
.finally(() => (busy.value = false));
};
</script>