fix(ios): togglePin 改用 APIClient.request 替代不存在的 .post

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
wangdl 2026-05-30 09:07:23 +08:00
parent d1b3ac160a
commit e254db0ba4

View File

@ -64,14 +64,11 @@ class LibraryViewModel: ObservableObject {
func togglePin(id: String) async {
do {
let _ = try await api.post("/knowledge-bases/\(id)/pin")
// reload after pin toggle
let _: GenericSuccessResponse? = try? await APIClient.shared.request("/knowledge-bases/\(id)/pin", method: "POST")
await loadKnowledgeBases()
} catch {}
}
private var api: APIClient { APIClient.shared }
private func fetchKBs(page: Int) async throws -> [KnowledgeBase] {
switch currentFilter {
case .all: return try await KnowledgeBaseService.shared.list(page: page, limit: pageSize)