mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-12-23 05:19:42 +01:00
Forward error
This commit is contained in:
parent
ec8de5fb83
commit
e91a8b4b0a
@ -13,8 +13,8 @@ public struct TimelineView: View {
|
||||
switch viewModel.state {
|
||||
case .loading:
|
||||
loadingRow
|
||||
case .error:
|
||||
Text("An error occurred, please try to refresh")
|
||||
case let .error(error):
|
||||
Text(error.localizedDescription)
|
||||
case let .display(statuses, nextPageState):
|
||||
ForEach(statuses) { status in
|
||||
StatusRowView(status: status)
|
||||
|
@ -9,7 +9,7 @@ class TimelineViewModel: ObservableObject {
|
||||
}
|
||||
case loading
|
||||
case display(statuses: [Status], nextPageState: State.PadingState)
|
||||
case error
|
||||
case error(error: Error)
|
||||
}
|
||||
|
||||
private let client: Client
|
||||
@ -30,7 +30,7 @@ class TimelineViewModel: ObservableObject {
|
||||
statuses = try await client.fetchArray(endpoint: Timeline.pub(sinceId: nil))
|
||||
state = .display(statuses: statuses, nextPageState: .hasNextPage)
|
||||
} catch {
|
||||
print(error.localizedDescription)
|
||||
state = .error(error: error)
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ class TimelineViewModel: ObservableObject {
|
||||
statuses.append(contentsOf: newStatuses)
|
||||
state = .display(statuses: statuses, nextPageState: .hasNextPage)
|
||||
} catch {
|
||||
print(error.localizedDescription)
|
||||
state = .error(error: error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user