Leptos updated to 0.5

This commit is contained in:
2023-09-15 13:55:01 +02:00
parent 9dd0993204
commit bbad2bb183
18 changed files with 234 additions and 281 deletions
+7 -8
View File
@@ -4,33 +4,32 @@ use crate::validator::Validator;
#[component]
pub fn ValidationErr(
cx: Scope,
validator: Validator,
) -> impl IntoView {
view! {cx, {move || {
view! {{move || {
if !validator.is_valid() {
if let Some(msgs) = validator.messages() {
let out_msgs = msgs.into_iter().map(move |e| {
view! {cx,
view! {
<div class="alert alert-danger">
{trl(cx, &e)}
{trl(&e)}
</div>
}
}).collect_view(cx);
view! {cx,
}).collect_view();
view! {
<div>
{out_msgs}
</div>
}
} else {
view! {cx,
view! {
<div class="alert alert-danger">
"Validation error"
</div>
}
}
} else {
view! {cx, <div></div>}
view! {<div></div>}
}
}}
}