web: rewrite frontend to use graphql for search results

This commit is contained in:
2023-11-25 09:06:24 -08:00
parent 3e3024dd5c
commit 0737f5aac5
7 changed files with 380 additions and 34 deletions

View File

@@ -15,14 +15,14 @@ use serde::{de::DeserializeOwned, Deserialize, Serialize};
)]
pub struct FrontPageQuery;
async fn send_graphql<Body, Resp>(body: Body) -> fetch::Result<graphql_client::Response<Resp>>
pub async fn send_graphql<Body, Resp>(body: Body) -> fetch::Result<graphql_client::Response<Resp>>
where
Body: Serialize,
Resp: DeserializeOwned + 'static,
{
use web_sys::RequestMode;
Request::new("/graphql")
Request::new("/graphql/")
.method(Method::Post)
.header(Header::content_type("application/json"))
.mode(RequestMode::Cors)