feat: preventing enter in signin text fields

This commit is contained in:
antifallobst 2023-10-02 20:23:01 +02:00
parent 93cacdb8e5
commit 482e5d60a4
Signed by: antifallobst
GPG Key ID: 2B4F402172791BAF
1 changed files with 4 additions and 6 deletions

View File

@ -52,9 +52,7 @@ pub fn SignIn(props: &Props) -> Html {
});
let status_callback = props.status_callback.clone();
let onsubmit = Callback::from(move |event: SubmitEvent| {
event.prevent_default();
let onsubmit = Callback::from(move |_| {
let state = state.deref().clone();
session.login(
@ -66,7 +64,7 @@ pub fn SignIn(props: &Props) -> Html {
});
html! {
<form class="auth-container" onsubmit={onsubmit}>
<div class="auth-container">
<div class="auth-field">
<label for="username">{"Username"}</label><br/>
<input class="auth-input" type="text" name="username" onchange={on_username_changed}/><br/>
@ -78,12 +76,12 @@ pub fn SignIn(props: &Props) -> Html {
</div>
<div class="center-x">
<button class="auth-submit" type="submit">{"Sign In"}</button>
<button class="auth-submit" onclick={onsubmit}>{"Sign In"}</button>
</div>
<div class="center-x">
<p class="auth-status">{props.status.clone()}</p>
</div>
</form>
</div>
}
}