Skip to content

Instantly share code, notes, and snippets.

@zacck-zz
Last active January 17, 2019 14:47
Show Gist options
  • Save zacck-zz/92113df9f14157e48e3db04947a8fdf0 to your computer and use it in GitHub Desktop.
Save zacck-zz/92113df9f14157e48e3db04947a8fdf0 to your computer and use it in GitHub Desktop.
-- GraphQL
type alias User =
{ username : Maybe String
, email : Maybe String
, id : Maybe EatYourDay.Scalar.Id
}
type alias SignIn =
{ user : Maybe User
, token : Maybe String
}
credential : SelectionSet SignIn EatYourDay.Object.SignIn
credential =
SelectionSet.succeed SignIn
|> with (SignIn.user user)
|> with SignIn.token
user : SelectionSet User EatYourDay.Object.User
user =
SelectionSet.succeed User
|> with User.username
|> with User.email
|> with User.id
signInMutation : Model -> SelectionSet (Maybe SignIn) RootMutation
signInMutation { form } =
Mutation.signIn { input = { signInParam = form.email, password = form.password }} credential
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment