Added DataForm component for easier edit dialogs.

This commit is contained in:
2023-09-28 21:42:12 +02:00
parent 0f8166913d
commit a7188e8153
10 changed files with 204 additions and 198 deletions
+8
View File
@@ -1,5 +1,7 @@
use leptos::*;
use validator::Validate;
use crate::backend::data::{ApiResponse, Company};
use crate::components::data_form::ForValidation;
#[server(GetCompany, "/api", "Url", "get_company")]
pub async fn get_company() -> Result<ApiResponse<Company>, ServerFnError> {
@@ -44,3 +46,9 @@ pub async fn update_company(company: Company) -> Result<ApiResponse<()>, ServerF
Ok(ApiResponse::Data(()))
}
impl ForValidation for UpdateCompany {
fn entity(&self) -> &dyn Validate {
&self.company
}
}