push addons to API after install
@@ -96,6 +96,14 @@ pub fn update_profile<Env: Environment + 'static>(
.iter()
.map(|addon| &addon.transport_url)
.position(|transport_url| *transport_url == addon.transport_url);
+ let push_to_api_effects = match &profile.auth {
+ Some(auth) => Effects::one(push_addons_to_api::<Env>(
+ profile.addons.to_owned(),
+ &auth.key,
+ ))
+ .unchanged(),
+ _ => Effects::none().unchanged(),
+ };
if let Some(addon_position) = addon_position {
profile.addons[addon_position] = addon.to_owned();
} else {
@@ -104,6 +112,7 @@ pub fn update_profile<Env: Environment + 'static>(
Effects::msg(Msg::Event(Event::AddonInstalled {
transport_url: addon.transport_url.to_owned(),
}))
+ .join(push_to_api_effects)
.join(Effects::msg(Msg::Internal(Internal::ProfileChanged(false))))
} else {
Effects::msg(Msg::Event(Event::Error {
