From cff4c827ca7d247d218fb9a6606fe265fef29444 Mon Sep 17 00:00:00 2001 From: alemi Date: Sun, 21 Apr 2024 19:37:20 +0200 Subject: [PATCH] feat(web): AP debug page to see remote objects --- web/src/app.rs | 2 ++ web/src/control.rs | 2 +- web/src/page.rs | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/web/src/app.rs b/web/src/app.rs index 9bc310ba..9f2a3071 100644 --- a/web/src/app.rs +++ b/web/src/app.rs @@ -99,6 +99,8 @@ pub fn App() -> impl IntoView { } /> } /> + + } /> diff --git a/web/src/control.rs b/web/src/control.rs index 0b296490..4e49f42d 100644 --- a/web/src/control.rs +++ b/web/src/control.rs @@ -10,7 +10,7 @@ pub fn Navigator() -> impl IntoView { - + } } diff --git a/web/src/page.rs b/web/src/page.rs index 3e02b2a6..324675b6 100644 --- a/web/src/page.rs +++ b/web/src/page.rs @@ -196,3 +196,39 @@ pub fn TimelinePage(name: &'static str, tl: Timeline) -> impl IntoView { } } + +#[component] +pub fn DebugPage() -> impl IntoView { + let url_ref: NodeRef = create_node_ref(); + let (object, set_object) = create_signal(serde_json::Value::String( + "use this view to fetch remote AP objects and inspect their content".into()) + ); + let auth = use_context::().expect("missing auth context"); + view! { +
+ debug +
+ + + + + +
+ (&url, auth).await { + Ok(x) => set_object.set(x), + Err(e) => set_object.set(serde_json::Value::String(e.to_string())), + } + }); + } /> +
+
+
+				{move || serde_json::to_string_pretty(&object.get()).unwrap_or("unserializable".to_string())}
+			
+
+ } +}