diff options
Diffstat (limited to 'webapp/src/components/error_info.rs')
-rw-r--r-- | webapp/src/components/error_info.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/webapp/src/components/error_info.rs b/webapp/src/components/error_info.rs new file mode 100644 index 0000000..4ec5ba9 --- /dev/null +++ b/webapp/src/components/error_info.rs @@ -0,0 +1,17 @@ +use crate::components::app_context_provider::ErrorInfoProperties; +use yew::prelude::*; + +#[function_component(ErrorInfo)] +pub fn error_info(props: &ErrorInfoProperties) -> Html { + let reload = Callback::from(move |_| { + web_sys::window().unwrap().location().reload().unwrap(); + }); + html! { + <div class="error-box"> + <p> + { format!("Error: {}. ", props.message) } + <button onclick={reload}>{ "Reload" }</button> + </p> + </div> + } +} |