fix GET when query is set
This commit is contained in:
parent
1da3cd2cef
commit
7d7dd0d64c
2 changed files with 5 additions and 3 deletions
|
@ -23,6 +23,7 @@ The main use case is for [Medkit](https://github.com/kayteh/medkit2) bot to have
|
|||
- Backup will connect to Census. It will wait for 60 seconds before deciding the primary is dead, and then start processing events.
|
||||
- API
|
||||
- Serves https://saerro.harasse.rs
|
||||
- Built on axum and async-graphql
|
||||
- Redis
|
||||
- Using ZADD with score as timestamp, ZCOUNTBYSCORE by timestamp in 15 minute windows, and cleaned up with SCAN+ZREMBYSCORE, population data is tracked.
|
||||
- There is deliberately no persistence.
|
||||
|
|
|
@ -42,10 +42,11 @@ async fn graphql_handler_get(
|
|||
Extension(schema): Extension<Schema<query::Query, EmptyMutation, EmptySubscription>>,
|
||||
query: Query<Request>,
|
||||
) -> axum::response::Response {
|
||||
match query.operation_name {
|
||||
Some(_) => Json(schema.execute(query.0).await).into_response(),
|
||||
None => Redirect::to("/graphql/playground").into_response(),
|
||||
if query.query == "" {
|
||||
return Redirect::to("/graphql/playground").into_response();
|
||||
}
|
||||
|
||||
Json(schema.execute(query.0).await).into_response()
|
||||
}
|
||||
async fn graphql_playground() -> impl IntoResponse {
|
||||
Html(playground_source(GraphQLPlaygroundConfig::new("/graphql")))
|
||||
|
|
Loading…
Add table
Reference in a new issue