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/name.rs | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'src/view/name.rs') diff --git a/src/view/name.rs b/src/view/name.rs index d864e35..27dadf1 100644 --- a/src/view/name.rs +++ b/src/view/name.rs @@ -1,8 +1,5 @@ -use yew::services::ConsoleService; use yew::prelude::*; use yewtil::NeqAssign; -use yewtil::ptr::Irc; -use yewtil::ptr::Mrc; use crate::viewmodel::Error; use crate::view::WeakComponentLink; use crate::viewmodel::name::*; @@ -25,7 +22,7 @@ use super::VCardPropertyInputComponent; /// ``` pub struct NameView { props: Props, - value: Mrc, + value: Name, error: Option, } @@ -41,19 +38,13 @@ pub enum Msg { #[derive(Clone, PartialEq, Properties)] pub struct Props { - pub generated: Callback>, + pub generated: Callback, pub weak_link: WeakComponentLink, } impl VCardPropertyInputComponent for NameView { fn get_input_object(&self) -> Name { - match self.value.clone().try_unwrap() { - Ok(name) => name, - Err(_) => { - ConsoleService::error("Couldn't unwrap name"); - Name::new() - }, - } + self.value.clone() } fn get_title(&self) -> String { "Name".to_string() @@ -70,7 +61,7 @@ impl Component for NameView { props.weak_link.borrow_mut().replace(link); Self { props, - value: Mrc::new(Name::new()), + value: Name::new(), error: None, } } @@ -82,7 +73,7 @@ impl Component for NameView { Msg::UpdateLastName(l) => self.value.last_name = l, Msg::UpdateSuffix(s) => self.value.suffix = s, Msg::Generate => { - self.props.generated.emit(self.value.irc()); + self.props.generated.emit(self.value.clone()); }, }; true -- cgit v1.2.3