diff --git a/src/api/account/calls.rs b/src/api/account/calls.rs index f3f7626..6049ce2 100644 --- a/src/api/account/calls.rs +++ b/src/api/account/calls.rs @@ -29,7 +29,7 @@ async fn register( async fn verify(data: web::Data, body: web::Json) -> impl Responder { match handlers::verify(&data.pool, body.into_inner()).await { Ok(resp) => match resp { - data::VerifyResponse::Success => HttpResponse::Ok().finish(), + data::VerifyResponse::Success(b) => HttpResponse::Ok().json(web::Json(b)), data::VerifyResponse::TokenUnknown => HttpResponse::NotFound().finish(), data::VerifyResponse::Blocked => HttpResponse::Forbidden().finish(), }, diff --git a/src/api/account/data.rs b/src/api/account/data.rs index 1e24061..1f37eb8 100644 --- a/src/api/account/data.rs +++ b/src/api/account/data.rs @@ -34,9 +34,14 @@ pub struct VerifyRequest { pub token: String, } +#[derive(Debug, Serialize)] +pub struct VerifySuccess { + pub token: String, +} + #[derive(Debug)] pub enum VerifyResponse { - Success, + Success(VerifySuccess), Blocked, TokenUnknown, } diff --git a/src/api/account/handlers.rs b/src/api/account/handlers.rs index 5ee4370..f84d0e4 100644 --- a/src/api/account/handlers.rs +++ b/src/api/account/handlers.rs @@ -103,7 +103,11 @@ pub async fn verify(pool: &PgPool, request: data::VerifyRequest) -> Result