From 0c8f99f4f58953334731cc195c385d31d8b0f695 Mon Sep 17 00:00:00 2001 From: jelemux Date: Thu, 4 Feb 2021 16:26:56 +0100 Subject: it works! --- src/view/address.rs | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'src/view/address.rs') diff --git a/src/view/address.rs b/src/view/address.rs index 01c949b..1aedcbd 100644 --- a/src/view/address.rs +++ b/src/view/address.rs @@ -1,8 +1,5 @@ -use yew::services::ConsoleService; use yew::prelude::*; use yewtil::NeqAssign; -use yewtil::ptr::Irc; -use yewtil::ptr::Mrc; use super::WeakComponentLink; use crate::viewmodel::address::*; use crate::viewmodel::VCardPropertyInputObject; @@ -25,7 +22,7 @@ use crate::viewmodel::Error; /// ``` pub struct AddressView { props: Props, - value: Mrc
, + value: Address, error: Option, } @@ -45,19 +42,13 @@ pub enum Msg { #[derive(Clone, PartialEq, Properties)] pub struct Props { - pub generated: Callback>, + pub generated: Callback
, pub weak_link: WeakComponentLink, } impl VCardPropertyInputComponent
for AddressView { fn get_input_object(&self) -> Address { - match self.value.irc().try_unwrap() { - Ok(address) => address, - Err(_) => { - ConsoleService::error("Couldn't unwrap address"); - Address::new() - }, - } + self.value.clone() } fn get_title(&self) -> String { "Address".to_string() @@ -74,7 +65,7 @@ impl Component for AddressView { props.weak_link.borrow_mut().replace(link); Self { props, - value: Mrc::new(Address::new()), + value: Address::new(), error: None, } } @@ -90,7 +81,7 @@ impl Component for AddressView { Msg::ToggleWork => self.value.work = !self.value.work, Msg::ToggleHome => self.value.home = !self.value.home, Msg::Generate => { - self.props.generated.emit(self.value.irc()); + self.props.generated.emit(self.value.clone()); }, }; true -- cgit v1.2.3