Added DataForm component for easier edit dialogs.
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user