You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
940 B
Rust

use leptos::*;
use crate::locales::trl;
use crate::validator::Validator;
#[component]
pub fn ValidationErr(
validator: Validator,
) -> impl IntoView {
view! {{move || {
if !validator.is_valid() {
if let Some(msgs) = validator.messages() {
let out_msgs = msgs.into_iter().map(move |e| {
view! {
<div class="alert alert-danger">
{trl(&e)}
</div>
}
}).collect_view();
view! {
<div>
{out_msgs}
</div>
}
} else {
view! {
<div class="alert alert-danger">
{trl("Validation error")}
</div>
}
}
} else {
view! {<div></div>}
}
}}
}
}