refactor: make the serverside error handling more robust

This commit is contained in:
2024-08-18 19:09:40 +02:00
parent ad70b5cfa8
commit f0f24d33ba
12 changed files with 301 additions and 43 deletions

View File

@ -10,7 +10,7 @@ pub(crate) fn Home() -> Element {
ProjectForm {
onsubmit: move |title| {
spawn(async move {
let _ = create_project(title).await;
create_project(title).await;
});
}
}

View File

@ -1,13 +1,14 @@
use crate::models::project::NewProject;
use dioxus::core_macro::{component, rsx};
use dioxus::dioxus_core::Element;
use dioxus::prelude::*;
#[component]
pub(crate) fn ProjectForm(onsubmit: EventHandler<String>) -> Element {
pub(crate) fn ProjectForm(onsubmit: EventHandler<NewProject>) -> Element {
rsx! {
form {
onsubmit: move |event| {
onsubmit(event.values().get("title").unwrap().as_value());
onsubmit(NewProject::new(event.values().get("title").unwrap().as_value()));
},
input {
r#type: "text",