From a92fb07d23fb2268a6f4e650c5cbd00ad993e760 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Wed, 21 Aug 2024 13:25:55 +0200 Subject: Add login Fields sent are ``` { "query": "mutation Login($input: LoginCredentials!) { login(input: $input) { accessToken tokenType } }", "variables": { "input": { "email": "....", "password": "..." } } } ``` --- src/main.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index e87a7c4..04e2564 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,7 +8,7 @@ mod state; use std::{net::SocketAddr, sync::Arc, time::Duration}; use crate::config::CONFIG; -use async_graphql::{EmptyMutation, EmptySubscription, Schema}; +use async_graphql::{EmptySubscription, Schema}; use axum::{ http::{header, Request}, routing::post, @@ -30,9 +30,13 @@ async fn create_app() -> Router { client: Arc::new(dbclient), }; - let schema = Schema::build(graphql::query::Query, EmptyMutation, EmptySubscription) - .data(state.clone()) - .finish(); + let schema = Schema::build( + graphql::query::Query, + graphql::mutation::Mutation, + EmptySubscription, + ) + .data(state.clone()) + .finish(); Router::new() .route( "/graphql", -- cgit v1.2.3-18-g5258