Sync embed load
This commit is contained in:
parent
0423351f5d
commit
38b7eaa0b2
|
@ -50,16 +50,18 @@ public class StatusRowViewModel: ObservableObject {
|
||||||
withAnimation {
|
withAnimation {
|
||||||
isEmbedLoading = true
|
isEmbedLoading = true
|
||||||
}
|
}
|
||||||
|
var embed: Status?
|
||||||
if url.absoluteString.contains(client.server), let id = Int(url.lastPathComponent) {
|
if url.absoluteString.contains(client.server), let id = Int(url.lastPathComponent) {
|
||||||
self.embededStatus = try await client.get(endpoint: Statuses.status(id: String(id)))
|
embed = try await client.get(endpoint: Statuses.status(id: String(id)))
|
||||||
} else {
|
} else {
|
||||||
let results: SearchResults = try await client.get(endpoint: Search.search(query: url.absoluteString,
|
let results: SearchResults = try await client.get(endpoint: Search.search(query: url.absoluteString,
|
||||||
type: "statuses",
|
type: "statuses",
|
||||||
offset: 0),
|
offset: 0),
|
||||||
forceVersion: .v2)
|
forceVersion: .v2)
|
||||||
self.embededStatus = results.statuses.first
|
embed = results.statuses.first
|
||||||
}
|
}
|
||||||
withAnimation {
|
withAnimation {
|
||||||
|
embededStatus = embed
|
||||||
isEmbedLoading = false
|
isEmbedLoading = false
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
|
|
Loading…
Reference in New Issue