fix issue 51 library reclassify regressions

This commit is contained in:
ShukeBta
2026-06-27 00:40:39 +08:00
parent 4c839b3f4e
commit 8d0aa2b589
15 changed files with 371 additions and 35 deletions
+7
View File
@@ -87,6 +87,13 @@ export const libraryAPI = {
})
.then((r) => r.data),
get: (id: string, options?: { includeHidden?: boolean }) =>
api
.get<Library>(`/libraries/${id}`, {
params: options?.includeHidden ? { include_hidden: 1 } : undefined,
})
.then((r) => r.data),
create: (name: string, path: string, type: string) =>
api.post<Library>('/libraries', { name, path, type }).then((r) => r.data),
+18 -4
View File
@@ -27,10 +27,24 @@ export function useLibraryData(libraryID: string, selectedSeries: SeriesCard | n
useEffect(() => {
if (!libraryID) return
libraryAPI.list().then((all) => {
const lib = all.find((item) => item.id === libraryID) ?? null
setLibrary(lib)
})
let cancelled = false
setLoading(true)
setLibrary(null)
setItems([])
setServerSeriesCards([])
setSeriesEpisodeItems([])
libraryAPI.get(libraryID)
.then((lib) => {
if (!cancelled) setLibrary(lib)
})
.catch(() => {
if (!cancelled) {
setLibrary(null)
setLoading(false)
toast.error('媒体库不存在或无权限')
}
})
return () => { cancelled = true }
}, [libraryID])
useEffect(() => {