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/telephone.rs | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'src/view/telephone.rs') diff --git a/src/view/telephone.rs b/src/view/telephone.rs index 63fdee7..5db8ae1 100644 --- a/src/view/telephone.rs +++ b/src/view/telephone.rs @@ -1,7 +1,4 @@ use yew::prelude::*; -use yew::services::ConsoleService; -use yewtil::ptr::Irc; -use yewtil::ptr::Mrc; use yewtil::NeqAssign; use crate::view::WeakComponentLink; use crate::viewmodel::Error; @@ -25,7 +22,7 @@ use super::VCardPropertyInputComponent; /// ``` pub struct TelephoneView { props: Props, - value: Mrc, + value: Telephone, error: Option, } @@ -46,19 +43,13 @@ pub enum Msg { #[derive(Clone, PartialEq, Properties)] pub struct Props { - pub generated: Callback>, + pub generated: Callback, pub weak_link: WeakComponentLink, } impl VCardPropertyInputComponent for TelephoneView { fn get_input_object(&self) -> Telephone { - match self.value.irc().try_unwrap() { - Ok(telephone) => telephone, - Err(_) => { - ConsoleService::error("Couldn't unwrap telephone"); - Telephone::new() - }, - } + self.value.clone() } fn get_title(&self) -> String { "Telephone".to_string() @@ -75,7 +66,7 @@ impl Component for TelephoneView { props.weak_link.borrow_mut().replace(link); Self { props, - value: Mrc::new(Telephone::new()), + value: Telephone::new(), error: None, } } @@ -92,7 +83,7 @@ impl Component for TelephoneView { Msg::TogglePager => self.value.pager = !self.value.pager, Msg::ToggleTextPhone => self.value.text_phone = !self.value.text_phone, Msg::Generate => { - self.props.generated.emit(self.value.irc()); + self.props.generated.emit(self.value.clone()); } }; true -- cgit v1.2.3