summaryrefslogtreecommitdiffstats
path: root/gui/src/app/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'gui/src/app/mod.rs')
-rw-r--r--gui/src/app/mod.rs20
1 files changed, 19 insertions, 1 deletions
diff --git a/gui/src/app/mod.rs b/gui/src/app/mod.rs
index f51581b..a1428cd 100644
--- a/gui/src/app/mod.rs
+++ b/gui/src/app/mod.rs
@@ -136,9 +136,27 @@ impl Application for Distrox {
Message::PostCreated(cid) => {
*input_value = String::new();
log::info!("Post created: {}", cid);
- iced::Command::none()
+
+ let profile = profile.clone();
+ iced::Command::perform(async move {
+ if let Err(e) = profile.read().await.save().await {
+ Message::ProfileStateSavingFailed(e.to_string())
+ } else {
+ Message::ProfileStateSaved
+ }
+ }, |m: Message| -> Message { m })
}
+ Message::ProfileStateSaved => {
+ log::info!("Profile state saved");
+ iced::Command::none()
+ },
+
+ Message::ProfileStateSavingFailed(e) => {
+ log::error!("Saving profile failed: {}", e);
+ iced::Command::none()
+ },
+
Message::PostCreationFailed(err) => {
log::error!("Post creation failed: {}", err);
iced::Command::none()