diff options
Diffstat (limited to 'src/view/address.rs')
-rw-r--r-- | src/view/address.rs | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/view/address.rs b/src/view/address.rs index b833518..23b697a 100644 --- a/src/view/address.rs +++ b/src/view/address.rs @@ -1,11 +1,11 @@ use super::WeakComponentLink; use yew::prelude::*; -use vcard::properties; use crate::viewmodel::address::*; use crate::viewmodel::VCardPropertyInputObject; use super::VCardPropertyInputComponent; use crate::viewmodel::Error; + pub struct AddressView { props: Props, value: Address, @@ -28,11 +28,11 @@ pub enum Msg { #[derive(Clone, PartialEq, Properties)] pub struct Props { - pub generated: Callback<Result<properties::Address,()>>, + pub generated: Callback<Address>, pub weak_link: WeakComponentLink<AddressView>, } -impl VCardPropertyInputComponent<properties::Address, Address> for AddressView { +impl VCardPropertyInputComponent<Address> for AddressView { fn get_input_object(&self) -> Address { self.value.clone() } @@ -67,16 +67,7 @@ impl Component for AddressView { Msg::ToggleWork => self.value.work = !self.value.work, Msg::ToggleHome => self.value.home = !self.value.home, Generate => { - match self.value.to_vcard_property() { - Ok(address) => { - self.props.generated.emit(Ok(address)); - return false; - }, - Err(error) => { - self.props.generated.emit(Err(())); - self.error = Some(error); - }, - }; + self.props.generated.emit(self.value); }, }; true |