Remove needless fetchArray

This commit is contained in:
Thomas Ricouard 2022-11-25 12:29:42 +01:00
parent e91a8b4b0a
commit 4742e3112b
2 changed files with 1 additions and 6 deletions

View file

@ -31,9 +31,4 @@ public class Client: ObservableObject {
let (data, _) = try await urlSession.data(from: makeURL(endpoint: endpoint))
return try decoder.decode(Entity.self, from: data)
}
public func fetchArray<Entity: Codable>(endpoint: Endpoint) async throws -> [Entity] {
let (data, _) = try await urlSession.data(from: makeURL(endpoint: endpoint))
return try decoder.decode([Entity].self, from: data)
}
}

View file

@ -27,7 +27,7 @@ class TimelineViewModel: ObservableObject {
func refreshTimeline() async {
do {
statuses = try await client.fetchArray(endpoint: Timeline.pub(sinceId: nil))
statuses = try await client.fetch(endpoint: Timeline.pub(sinceId: nil))
state = .display(statuses: statuses, nextPageState: .hasNextPage)
} catch {
state = .error(error: error)