summaryrefslogtreecommitdiff
path: root/src/view/telephone.rs
diff options
context:
space:
mode:
authorjelemux <jeremias.weber@protonmail.com>2021-02-04 16:26:56 +0100
committerjelemux <jeremias.weber@protonmail.com>2021-02-04 16:26:56 +0100
commit0c8f99f4f58953334731cc195c385d31d8b0f695 (patch)
tree8d41d47ded008873b28a378fdbc74a9b0257dbf3 /src/view/telephone.rs
parent69ceb1f9ec68e41029759a6fcff3168adb6df373 (diff)
downloadwasm-card-0c8f99f4f58953334731cc195c385d31d8b0f695.tar.gz
wasm-card-0c8f99f4f58953334731cc195c385d31d8b0f695.tar.bz2
it works!
Diffstat (limited to 'src/view/telephone.rs')
-rw-r--r--src/view/telephone.rs19
1 files changed, 5 insertions, 14 deletions
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<Telephone>,
+ value: Telephone,
error: Option<Error>,
}
@@ -46,19 +43,13 @@ pub enum Msg {
#[derive(Clone, PartialEq, Properties)]
pub struct Props {
- pub generated: Callback<Irc<Telephone>>,
+ pub generated: Callback<Telephone>,
pub weak_link: WeakComponentLink<TelephoneView>,
}
impl VCardPropertyInputComponent<Telephone> 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