feat(web): use forms for login and dbg
This commit is contained in:
parent
5ba1fb66ca
commit
41b9ee4044
2 changed files with 20 additions and 16 deletions
|
@ -36,9 +36,8 @@ pub fn LoginBox(
|
|||
} />
|
||||
</div>
|
||||
<div class:hidden=move || token.present() >
|
||||
<input class="w-100" type="text" node_ref=username_ref placeholder="username" />
|
||||
<input class="w-100" type="text" node_ref=password_ref placeholder="password" />
|
||||
<input class="w-100" type="submit" value="login" on:click=move |_| {
|
||||
<form on:submit=move|ev| {
|
||||
ev.prevent_default();
|
||||
logging::log!("logging in...");
|
||||
let email = username_ref.get().map(|x| x.value()).unwrap_or("".into());
|
||||
let password = password_ref.get().map(|x| x.value()).unwrap_or("".into());
|
||||
|
@ -70,7 +69,11 @@ pub fn LoginBox(
|
|||
}
|
||||
});
|
||||
});
|
||||
} />
|
||||
} >
|
||||
<input class="w-100" type="text" node_ref=username_ref placeholder="username" />
|
||||
<input class="w-100" type="text" node_ref=password_ref placeholder="password" />
|
||||
<input class="w-100" type="submit" value="login" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
|
|
@ -208,11 +208,8 @@ pub fn DebugPage() -> impl IntoView {
|
|||
<div>
|
||||
<Breadcrumb back=true>debug</Breadcrumb>
|
||||
<div class="mt-1" >
|
||||
<table class="align w-100" >
|
||||
<tr>
|
||||
<td><input class="w-100" type="text" node_ref=url_ref placeholder="AP id" /></td>
|
||||
<td>
|
||||
<input type="submit" class="w-100" value="fetch" on:click=move |_| {
|
||||
<form on:submit=move|ev| {
|
||||
ev.prevent_default();
|
||||
let fetch_url = url_ref.get().map(|x| x.value()).unwrap_or("".into());
|
||||
let url = format!("{URL_BASE}/dbg?id={fetch_url}");
|
||||
spawn_local(async move {
|
||||
|
@ -221,10 +218,14 @@ pub fn DebugPage() -> impl IntoView {
|
|||
Err(e) => set_object.set(serde_json::Value::String(e.to_string())),
|
||||
}
|
||||
});
|
||||
} />
|
||||
</td>
|
||||
} >
|
||||
<table class="align w-100" >
|
||||
<tr>
|
||||
<td><input class="w-100" type="text" node_ref=url_ref placeholder="AP id" /></td>
|
||||
<td><input type="submit" class="w-100" value="fetch" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<pre class="ma-1" >
|
||||
{move || serde_json::to_string_pretty(&object.get()).unwrap_or("unserializable".to_string())}
|
||||
|
|
Loading…
Reference in a new issue