feat(web): explicit button to fetch replies
This commit is contained in:
parent
187a659608
commit
80940b1880
2 changed files with 13 additions and 3 deletions
|
@ -41,9 +41,22 @@ pub fn ObjectView() -> impl IntoView {
|
|||
<hr class="color ma-2" />
|
||||
<code class="cw color center mt-1 mb-1 ml-3 mr-3">
|
||||
<a class="clean" href=format!("{base}/context")><span class="emoji">"🕸️"</span>" "<b>context</b></a>" | "<a class="clean" href=format!("{base}/replies")><span class="emoji">"📫"</span>" "<b>replies</b></a>
|
||||
{if auth.present() {
|
||||
Some(view! {
|
||||
" | "<a class="clean" href="#crawl" on:click=move |_| crawl(base.clone(), auth) ><span class="emoji">"↺"</span></a>
|
||||
})
|
||||
} else { None }}
|
||||
</code>
|
||||
<Outlet />
|
||||
}.into_view()
|
||||
},
|
||||
}}
|
||||
}
|
||||
|
||||
fn crawl(base: String, auth: Auth) {
|
||||
spawn_local(async move {
|
||||
if let Err(e) = Http::fetch::<serde_json::Value>(&format!("{base}/replies?fetch=true"), auth).await {
|
||||
tracing::error!("failed crawling replies for {base}: {e}");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -84,9 +84,6 @@ impl Timeline {
|
|||
feed_url + "?replies=false"
|
||||
};
|
||||
}
|
||||
if auth.present() {
|
||||
feed_url += "&fetch=true";
|
||||
}
|
||||
let collection : serde_json::Value = Http::fetch(&feed_url, auth).await?;
|
||||
let activities : Vec<serde_json::Value> = collection
|
||||
.ordered_items()
|
||||
|
|
Loading…
Reference in a new issue