Skip to content

Instantly share code, notes, and snippets.

@grrinchas
Created January 6, 2018 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grrinchas/dff7d6f59484be2a28617b787c7e1dff to your computer and use it in GitHub Desktop.
Save grrinchas/dff7d6f59484be2a28617b787c7e1dff to your computer and use it in GitHub Desktop.
postsQuery : Encoder.Value
postsQuery =
Encoder.object
[ ( "query", Encoder.string "query {allPosts(orderBy: createdAt_DESC){id title body}}" ) ]
authenticate : Token -> Encoder.Value
authenticate token =
let
query =
"mutation {authenticate (accessToken: \"" ++ token.accessToken ++ "\"){token}}"
in
Encoder.object
[ ( "query", Encoder.string query ) ]
createPost : Form -> Encoder.Value
createPost form =
let
query =
"mutation {createPost(title: \"" ++ form.postTitle ++ "\" body: \"" ++ form.postBody ++ "\"" ++ "){id}}"
in
Encoder.object
[ ( "query", Encoder.string query ) ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment