t添加标签功能

This commit is contained in:
truewhile
2026-09-16 12:30:34 +08:00
parent 57ee482146
commit cbfae0252e
19 changed files with 1696 additions and 29 deletions
+7 -1
View File
@@ -1,5 +1,5 @@
import { api } from './client'
import type { User } from '../types'
import type { LibraryTagSet, User } from '../types'
export const profileAPI = {
get: () => api.get<User>('/me').then((r) => r.data),
@@ -21,6 +21,12 @@ export const profileAPI = {
setPinnedLibraries: (libraryIds: string[]) =>
api.put<{ library_ids: string[] }>('/me/pinned-libraries', { library_ids: libraryIds }).then((r) => r.data.library_ids ?? []),
getLibraryTags: () =>
api.get<{ tags: LibraryTagSet[] | null }>('/me/library-tags').then((r) => r.data.tags ?? []),
setLibraryTags: (tags: LibraryTagSet[]) =>
api.put<{ tags: LibraryTagSet[] | null }>('/me/library-tags', { tags }).then((r) => r.data.tags ?? []),
adminUpdateRole: (id: string, role: 'admin' | 'user') =>
api.patch<User>(`/admin/users/${id}/role`, { role }).then((r) => r.data),
}