Skip to content

Instantly share code, notes, and snippets.

@ImadBoumzaoued
Created April 22, 2020 10:43
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 ImadBoumzaoued/fdbaca7c1fa4027d5a04fa144872adb5 to your computer and use it in GitHub Desktop.
Save ImadBoumzaoued/fdbaca7c1fa4027d5a04fa144872adb5 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const fetchMachine = Machine({
id: 'login',
context: {
message: undefined,
},
initial: 'idle',
states: {
idle: {
on: {
LOGIN: 'pending',
FORGOT_PASSWORD: 'recover',
},
},
pending: {
on: {
RESOLVE: 'success',
REJECT: 'fail',
},
},
fail: {},
success: 'final',
recover: {
initial: 'idle',
states: {
idle: {
on: {
RECOVER: 'pending',
LOGIN: '#login.idle',
},
},
pending: {
on: {
RESOLVE: 'success',
REJECT: 'fail',
},
},
fail: {
on: {
LOGIN: '#login.idle'
}
},
success: '#login.idle',
},
},
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment