13 lines
473 B
Rust
13 lines
473 B
Rust
|
|
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()))
|
||
|
|
}
|