Created
January 17, 2019 11:16
-
-
Save zacck-zz/8e6ba9b77f2919842bae15c474bec2fc to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import EatYourDay.Mutation as Mutation | |
import EatYourDay.Object | |
import EatYourDay.Object.SignIn as SignIn | |
import EatYourDay.Object.User as EatYourDayUser | |
import EatYourDay.Scalar exposing(Id(..)) | |
-- GraphQL | |
type alias User = | |
{ username: Maybe String | |
, email: Maybe String | |
, id: Maybe Id | |
} | |
user: SelectionSet User EatYourDay.Object.User | |
user = | |
EatYourDayUser.selection User | |
|> with EatYourDayUser.username | |
|> with EatYourDayUser.email | |
|> with EatYourDayUser.id | |
type alias LoginResp = | |
{ token: Maybe String | |
, user: Maybe User | |
} | |
credential: SelectionSet LoginResp EatYourDay.Object.SignIn | |
credential = | |
SignIn.selection LoginResp | |
|> with SignIn.token | |
|> with (SignIn.user user) | |
signInMutation : Model -> SelectionSet LoginResp RootMutation | |
signInMutation { form } = | |
Mutation.selection LoginResp | |
|> with (Mutation.signIn { input = { password = form.password, signInParam = form.email }} credential) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment