mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-26 02:01:02 +00:00
Fix #1236
This commit is contained in:
parent
aa120a48f7
commit
4f6f98271a
2 changed files with 7 additions and 1 deletions
|
@ -72,6 +72,7 @@ public struct StatusDetailView: View {
|
|||
.task {
|
||||
guard !isLoaded else { return }
|
||||
viewModel.client = client
|
||||
viewModel.routerPath = routerPath
|
||||
let result = await viewModel.fetch()
|
||||
isLoaded = true
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ class StatusDetailViewModel: ObservableObject {
|
|||
public var remoteStatusURL: URL?
|
||||
|
||||
var client: Client?
|
||||
var routerPath: RouterPath?
|
||||
|
||||
enum State {
|
||||
case loading, display(statuses: [Status], date: Date), error(error: Error)
|
||||
|
@ -93,7 +94,11 @@ class StatusDetailViewModel: ObservableObject {
|
|||
scrollToId = statusId
|
||||
}
|
||||
} catch {
|
||||
state = .error(error: error)
|
||||
if let error = error as? ServerError, error.httpCode == 404 {
|
||||
_ = routerPath?.path.popLast()
|
||||
} else {
|
||||
state = .error(error: error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue