remove sharing labels v1 api

This commit is contained in:
Gauthier Roebroeck 2026-03-09 17:02:59 +08:00
parent 3a4894fde0
commit 33b582ce20
3 changed files with 19 additions and 19 deletions

View file

@ -1,21 +1,7 @@
import { defineQuery, defineQueryOptions, useQuery } from '@pinia/colada'
import { defineQueryOptions } from '@pinia/colada'
import { komgaClient } from '@/api/komga-client'
import type { PageRequest } from '@/types/PageRequest'
export const useSharingLabels = defineQuery(() => {
return useQuery({
key: () => ['sharing-labels'],
query: () =>
komgaClient
.GET('/api/v1/sharing-labels')
// unwrap the openapi-fetch structure on success
.then((res) => res.data),
// 1 hour
staleTime: 60 * 60 * 1000,
gcTime: false,
})
})
export const authorsQuery = defineQueryOptions(
({
search,

View file

@ -2,6 +2,9 @@ import type { Meta, StoryObj } from '@storybook/vue3-vite'
import CreateEdit from './CreateEdit.vue'
import { UserRoles } from '@/types/UserRoles'
import { httpTyped } from '@/mocks/api/httpTyped'
import { mockPage } from '@/mocks/api/pageable'
import { PageRequest } from '@/types/PageRequest'
const meta = {
component: CreateEdit,
@ -19,6 +22,13 @@ const meta = {
component: '',
},
},
msw: {
handlers: [
httpTyped.get('/api/v2/sharing-labels', ({ response }) =>
response(200).json(mockPage(['kids', 'teens'], PageRequest.Unpaged())),
),
],
},
},
args: {},
} satisfies Meta<typeof CreateEdit>

View file

@ -211,7 +211,7 @@
closable-chips
multiple
hide-details
:items="sharingLabels"
:items="sharingLabels?.content"
>
<template #prepend-item>
<v-list-item>
@ -240,7 +240,7 @@
closable-chips
multiple
hide-details
:items="sharingLabels"
:items="sharingLabels?.content"
>
<template #prepend-item>
<v-list-item>
@ -259,9 +259,11 @@
import { UserRoles, userRolesMessages } from '@/types/UserRoles'
import type { components } from '@/generated/openapi/komga'
import { useLibraries } from '@/colada/libraries'
import { useSharingLabels } from '@/colada/referential'
import { sharingLabelsQuery } from '@/colada/referential'
import { useIntl } from 'vue-intl'
import { commonMessages } from '@/utils/i18n/common-messages'
import { useQuery } from '@pinia/colada'
import { PageRequest } from '@/types/PageRequest'
const intl = useIntl()
@ -278,7 +280,9 @@ const user = defineModel<UserCreation | UserUpdate>({ required: true })
const showPassword = ref<boolean>(false)
const { data: libraries } = useLibraries()
const { data: sharingLabels } = useSharingLabels()
const { data: sharingLabels } = useQuery(sharingLabelsQuery, () => ({
pageRequest: PageRequest.Unpaged(),
}))
function selectAllLibraries() {
user.value.sharedLibraries!.all = !user.value.sharedLibraries?.all