Created
January 6, 2018 12:46
-
-
Save grrinchas/dff7d6f59484be2a28617b787c7e1dff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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