feedsignal/crates/web/src/api/feeds.rs

13 lines
473 B
Rust
Raw Normal View History

use dioxus::prelude::*;
/// Registers a feed and fetches it immediately. Runs on the server (native,
/// has DB + network access); the `#[server]` macro generates the HTTP call
/// the browser/WASM build uses instead.
#[server]
pub async fn subscribe_feed(url: String) -> Result<usize, ServerFnError> {
let db = crate::server::db().await?;
crate::server::services::feeds::subscribe(db, url)
.await
.map_err(|e| ServerFnError::new(e.to_string()))
}