summaryrefslogtreecommitdiff
path: root/src/channel/routes.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/channel/routes.rs')
-rw-r--r--src/channel/routes.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/channel/routes.rs b/src/channel/routes.rs
index 83c733c..0f95c69 100644
--- a/src/channel/routes.rs
+++ b/src/channel/routes.rs
@@ -8,10 +8,13 @@ use axum::{
routing::{get, post},
Router,
};
-use futures::stream::{StreamExt as _, TryStreamExt as _};
+use futures::{future, stream::TryStreamExt as _};
use super::repo::channels::Id as ChannelId;
-use crate::{app::App, clock::RequestedAt, error::InternalError, login::repo::logins::Login};
+use crate::{
+ app::App, clock::RequestedAt, error::BoxedError, error::InternalError,
+ login::repo::logins::Login,
+};
pub fn router() -> Router<App> {
Router::new()
@@ -63,10 +66,7 @@ async fn on_events(
.channels()
.events(&channel)
.await?
- .map(|msg| match msg {
- Ok(msg) => Ok(serde_json::to_string(&msg)?),
- Err(err) => Err(err),
- })
+ .and_then(|msg| future::ready(serde_json::to_string(&msg).map_err(BoxedError::from)))
.map_ok(|msg| sse::Event::default().data(&msg));
Ok(Sse::new(stream).keep_alive(sse::KeepAlive::default()))