summaryrefslogtreecommitdiff
path: root/src/view/address.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/address.rs
parent69ceb1f9ec68e41029759a6fcff3168adb6df373 (diff)
downloadwasm-card-0c8f99f4f58953334731cc195c385d31d8b0f695.tar.gz
wasm-card-0c8f99f4f58953334731cc195c385d31d8b0f695.tar.bz2
it works!
Diffstat (limited to 'src/view/address.rs')
-rw-r--r--src/view/address.rs19
1 files changed, 5 insertions, 14 deletions
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<Address>,
+ value: Address,
error: Option<Error>,
}
@@ -45,19 +42,13 @@ pub enum Msg {
#[derive(Clone, PartialEq, Properties)]
pub struct Props {
- pub generated: Callback<Irc<Address>>,
+ pub generated: Callback<Address>,
pub weak_link: WeakComponentLink<AddressView>,
}
impl VCardPropertyInputComponent<Address> 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