Add page for displaying error
This commit is contained in:
24
src/pages/error.rs
Normal file
24
src/pages/error.rs
Normal file
@ -0,0 +1,24 @@
|
||||
use leptos::*;
|
||||
use leptos_icons::*;
|
||||
use std::fmt::Display;
|
||||
|
||||
#[component]
|
||||
pub fn ServerError<E: Display + 'static>(
|
||||
#[prop(optional, into, default="An Error Occurred".into())]
|
||||
title: TextProp,
|
||||
#[prop(optional, into)]
|
||||
message: TextProp,
|
||||
#[prop(optional, into)]
|
||||
error: Option<ServerFnError<E>>,
|
||||
) -> impl IntoView {
|
||||
view! {
|
||||
<div class="error-container home-component">
|
||||
<div class="error-header">
|
||||
<Icon icon=icondata::BiErrorSolid />
|
||||
<h1>{title}</h1>
|
||||
</div>
|
||||
<p>{message}</p>
|
||||
<p>{error.map(|error| format!("{}", error))}</p>
|
||||
</div>
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user