mirror of
https://github.com/C9Glax/tranga-website.git
synced 2025-10-11 21:29:50 +02:00
Use nuxtopenfetch
This commit is contained in:
@@ -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>
|
||||
|
@@ -36,7 +36,7 @@ export interface ChaptersListProps {
|
||||
}
|
||||
const props = defineProps<ChaptersListProps>();
|
||||
|
||||
const { data: chapters } = await useApiData('/v2/Manga/{MangaId}/Chapters', {
|
||||
const { data: chapters } = await useApi('/v2/Manga/{MangaId}/Chapters', {
|
||||
path: { MangaId: props.mangaId },
|
||||
key: FetchKeys.Chapters.All,
|
||||
});
|
||||
|
@@ -13,14 +13,14 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { ApiModel } from '#nuxt-api-party';
|
||||
type FileLibrary = ApiModel<'FileLibrary'>;
|
||||
const { data: fileLibraries } = await useApiData('/v2/FileLibrary', { key: FetchKeys.FileLibraries });
|
||||
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 (l: FileLibrary) => {
|
||||
const deleteLibrary = async (library: FileLibrary) => {
|
||||
busy.value = true;
|
||||
await $api('/v2/FileLibrary/{FileLibraryId}', { path: { FileLibraryId: l.key }, method: 'DELETE' })
|
||||
await useApi('/v2/FileLibrary/{FileLibraryId}', { path: { FileLibraryId: library.key }, method: 'DELETE' })
|
||||
.then(() => refreshNuxtData(FetchKeys.FileLibraries))
|
||||
.finally(() => (busy.value = false));
|
||||
};
|
||||
|
@@ -33,10 +33,10 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { ApiModel } from '#nuxt-api-party';
|
||||
import type { components } from '#open-fetch-schemas/api';
|
||||
import type { PageCardProps } from '#ui/components/PageCard.vue';
|
||||
type Manga = ApiModel<'Manga'>;
|
||||
type MinimalManga = ApiModel<'MinimalManga'>;
|
||||
type Manga = components['schemas']['Manga'];
|
||||
type MinimalManga = components['schemas']['MinimalManga'];
|
||||
|
||||
defineProps<MangaCardProps>();
|
||||
defineEmits(['click']);
|
||||
|
@@ -12,14 +12,15 @@
|
||||
<p class="p-3 text-xl font-semibold max-h-full overflow-clip">{{ manga?.name }}</p>
|
||||
</div>
|
||||
<LazyNuxtImg
|
||||
:src="`${$config.public.apiParty.endpoints.Api!.url}v2/Manga/${manga.key}/Cover/Medium`"
|
||||
:src="`${$config.public.openFetch.api.baseURL}v2/Manga/${manga.key}/Cover/Medium`"
|
||||
class="w-full h-full object-cover" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { ApiModel } from '#nuxt-api-party';
|
||||
type MinimalManga = ApiModel<'MinimalManga'>;
|
||||
type Manga = ApiModel<'Manga'>;
|
||||
import type { components } from '#open-fetch-schemas/api';
|
||||
type Manga = components['schemas']['Manga'];
|
||||
type MinimalManga = components['schemas']['MinimalManga'];
|
||||
|
||||
defineProps<{ manga: Manga | MinimalManga; blur?: boolean }>();
|
||||
</script>
|
||||
|
@@ -40,8 +40,8 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { ApiModel } from '#nuxt-api-party';
|
||||
type Manga = ApiModel<'Manga'>;
|
||||
import type { components } from '#open-fetch-schemas/api';
|
||||
type Manga = components['schemas']['Manga'];
|
||||
|
||||
export interface MangaDetailPageProps {
|
||||
manga?: Manga;
|
||||
|
@@ -14,12 +14,12 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { ApiModel } from '#nuxt-api-party';
|
||||
type MangaConnectorId = /* @vue-ignore */ ApiModel<'MangaConnectorId'>;
|
||||
import type { components } from '#open-fetch-schemas/api';
|
||||
type MangaConnectorId = components['schemas']['MangaConnectorId'];
|
||||
|
||||
const props = defineProps<MangaConnectorId>();
|
||||
|
||||
const { data: mangaConnector } = await useApiData('/v2/MangaConnector/{MangaConnectorName}', {
|
||||
const { data: mangaConnector } = await useApi('/v2/MangaConnector/{MangaConnectorName}', {
|
||||
path: { MangaConnectorName: props.mangaConnectorName },
|
||||
key: FetchKeys.MangaConnector.Id(props.mangaConnectorName),
|
||||
});
|
||||
|
Reference in New Issue
Block a user