forked from alemi/upub
fix(web): user page responds to url again
This commit is contained in:
parent
e3831650ca
commit
7019671f93
2 changed files with 16 additions and 15 deletions
|
@ -34,8 +34,7 @@ pub fn App() -> impl IntoView {
|
||||||
let (menu, set_menu) = create_signal(screen_width <= 786);
|
let (menu, set_menu) = create_signal(screen_width <= 786);
|
||||||
let (advanced, set_advanced) = create_signal(false);
|
let (advanced, set_advanced) = create_signal(false);
|
||||||
|
|
||||||
let auth_present = auth.token.get_untracked().is_some(); // skip helper to use get_untracked
|
let title_target = move || if auth.present() { "/web/home" } else { "/web/server" };
|
||||||
let title_target = move || if auth_present { "/web/home" } else { "/web/server" };
|
|
||||||
|
|
||||||
if let Some(tok) = token.get_untracked() {
|
if let Some(tok) = token.get_untracked() {
|
||||||
spawn_local(async move {
|
spawn_local(async move {
|
||||||
|
@ -61,7 +60,7 @@ pub fn App() -> impl IntoView {
|
||||||
|
|
||||||
server_tl.more(auth);
|
server_tl.more(auth);
|
||||||
local_tl.more(auth);
|
local_tl.more(auth);
|
||||||
if auth_present { home_tl.more(auth) };
|
if auth.token.get_untracked().is_some() { home_tl.more(auth) };
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
server_tl.more(auth);
|
server_tl.more(auth);
|
||||||
|
|
|
@ -28,20 +28,22 @@ pub fn UserPage(tl: Timeline) -> impl IntoView {
|
||||||
.cloned()
|
.cloned()
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
let uid = uriproxy::uri(URL_BASE, uriproxy::UriClass::Actor, &id);
|
let uid = uriproxy::uri(URL_BASE, uriproxy::UriClass::Actor, &id);
|
||||||
let _uid = uid.clone();
|
let actor = create_local_resource(
|
||||||
let actor = create_local_resource(move || _uid.clone(), move |id| {
|
move || params.get().get("id").cloned().unwrap_or_default(),
|
||||||
async move {
|
move |id| {
|
||||||
match CACHE.get(&Uri::full(U::Actor, &id)) {
|
async move {
|
||||||
Some(x) => Some(x.clone()),
|
match CACHE.get(&Uri::full(U::Actor, &id)) {
|
||||||
None => {
|
Some(x) => Some(x.clone()),
|
||||||
let user : serde_json::Value = Http::fetch(&Uri::api(U::Actor, &id, true), auth).await.ok()?;
|
None => {
|
||||||
let user = Arc::new(user);
|
let user : serde_json::Value = Http::fetch(&Uri::api(U::Actor, &id, true), auth).await.ok()?;
|
||||||
CACHE.put(Uri::full(U::Actor, &id), user.clone());
|
let user = Arc::new(user);
|
||||||
Some(user)
|
CACHE.put(Uri::full(U::Actor, &id), user.clone());
|
||||||
},
|
Some(user)
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
view! {
|
view! {
|
||||||
<div>
|
<div>
|
||||||
<Breadcrumb back=true >
|
<Breadcrumb back=true >
|
||||||
|
|
Loading…
Reference in a new issue