summaryrefslogtreecommitdiff
path: root/src/view/address.rs
diff options
context:
space:
mode:
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