Skip to content

Instantly share code, notes, and snippets.

@kellyjandrews
Last active May 19, 2020 02:56
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 kellyjandrews/3a94c4f2b199e1a6a44d1c48a002998f to your computer and use it in GitHub Desktop.
Save kellyjandrews/3a94c4f2b199e1a6a44d1c48a002998f to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const authMachine = Machine({
id: 'auth',
context: {
email: '',
password: '',
loginModal: false
},
initial: 'unauthorized',
states: {
unauthorized: {
type: 'compound',
inital: `loginModal`,
states: {
loginModal:{
on: {
ENTER_EMAIL: {},
ENTER_PASSWORD: {},
EMAIL_BLUR: {},
PASSWORD_BLUR: {},
SUBMIT: {
target: '.authPending'
}
}
},
noLoginModal:{},
googleAuth:{
on: {
GOOGLE_AUTH: {
target: '.authPending'
}
}
},
email_err:{
on: {
ENTER_EMAIL: {
target: 'dataEntry',
}
}
},
password_err:{}
}
},
authError: {},
authPending: {},
authorized: {}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment