chore: clean up tauri commands

This commit is contained in:
reya
2024-05-18 14:59:34 +07:00
parent 99d9c70826
commit ca06f2b6ed
11 changed files with 21 additions and 388 deletions

View File

@@ -216,24 +216,3 @@ pub async fn repost(raw: &str, state: State<'_, Nostr>) -> Result<EventId, Strin
Err("Repost failed".into())
}
}
#[tauri::command]
pub async fn search(
content: &str,
limit: usize,
state: State<'_, Nostr>,
) -> Result<Vec<Event>, String> {
let client = &state.client;
let filter = Filter::new()
.kinds(vec![Kind::TextNote, Kind::Metadata])
.search(content)
.limit(limit);
match client
.get_events_of(vec![filter], Some(Duration::from_secs(15)))
.await
{
Ok(events) => Ok(events),
Err(err) => Err(err.to_string()),
}
}