diff --git a/Packages/Network/Sources/Network/Endpoint/Search.swift b/Packages/Network/Sources/Network/Endpoint/Search.swift index c111a3fb..69664578 100644 --- a/Packages/Network/Sources/Network/Endpoint/Search.swift +++ b/Packages/Network/Sources/Network/Endpoint/Search.swift @@ -2,17 +2,21 @@ import Foundation public enum Search: Endpoint { case search(query: String, type: String?, offset: Int?, following: Bool?) + case accountsSearch(query: String, type: String?, offset: Int?, following: Bool?) public func path() -> String { switch self { case .search: "search" + case .accountsSearch: + "accounts/search" } } public func queryItems() -> [URLQueryItem]? { switch self { - case let .search(query, type, offset, following): + case let .search(query, type, offset, following), + let .accountsSearch(query, type, offset, following): var params: [URLQueryItem] = [.init(name: "q", value: query)] if let type { params.append(.init(name: "type", value: type)) diff --git a/Packages/Status/Sources/Status/Editor/StatusEditorViewModel.swift b/Packages/Status/Sources/Status/Editor/StatusEditorViewModel.swift index d1785563..81c44282 100644 --- a/Packages/Status/Sources/Status/Editor/StatusEditorViewModel.swift +++ b/Packages/Status/Sources/Status/Editor/StatusEditorViewModel.swift @@ -482,16 +482,16 @@ import SwiftUI } case "@": query.removeFirst() - results = try await client.get(endpoint: Search.search(query: query, - type: "accounts", - offset: 0, - following: true), - forceVersion: .v2) + let accounts: [Account] = try await client.get(endpoint: Search.accountsSearch(query: query, + type: nil, + offset: 0, + following: nil), + forceVersion: .v1) guard !Task.isCancelled else { return } withAnimation { - mentionsSuggestions = results?.accounts ?? [] + mentionsSuggestions = accounts } default: break