SHARE
TWEET

Untitled

a guest Jun 20th, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let token = "asdasdasdasdas";
  2.  
  3. let loginPayload =
  4.   Schema.(
  5.     obj("Result", ~doc="Login auth result", ~fields=_ =>
  6.       [
  7.         io_field(
  8.           "token", ~typ=non_null(string), ~args=Arg.[], ~resolve=(ctx, s) =>
  9.           Lwt_result.return(token)
  10.         ),
  11.       ]
  12.     )
  13.   );
  14. let schema =
  15.   Schema.(
  16.     schema(
  17.       [
  18.         io_field(
  19.           "users",
  20.           ~typ=non_null(list(non_null(user))),
  21.           ~args=Arg.[],
  22.           ~resolve=(_, _) =>
  23.           Lwt_result.return(users)
  24.         ),
  25.       ],
  26.       ~mutations=[
  27.         io_field(
  28.           "login",
  29.           ~typ=non_null(loginPayload),
  30.           ~args=
  31.             Arg.[
  32.               arg("email", ~typ=non_null(string)),
  33.               arg("password", ~typ=non_null(string)),
  34.             ],
  35.           ~resolve=(_, _, email, password) => {
  36.             print_endline(email);
  37.             print_endline(password);
  38.             Lwt_result.return(token);
  39.           },
  40.         ),
  41.       ],
  42.     )
  43.   );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top