Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.60 KB | None | 0 0
  1. use actix_web::{AsyncResponder, FutureResponse, HttpResponse, Json, ResponseError, State};
  2. use futures::future::Future;
  3.  
  4. use app::AppState;
  5. use invitation_handler::CreateInvitation;
  6.  
  7. pub fn register_email((signup_invitation, state): (Json<CreateInvitation>, State<AppState>))
  8.     -> FutureResponse<HttpResponse> {
  9.     state
  10.         .db
  11.         .send(signup_invitation.into_inner())
  12.         .from_err()
  13.         .and_then(|db_response| match db_response {
  14.             Ok(invitation) => Ok(HttpResponse::Ok().json(invitation)),
  15.             Err(err) => Ok(err.error_response()),
  16.         }).responder()
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement