Skip to content

Instantly share code, notes, and snippets.

@FeliciousX
Last active May 12, 2020 03:20
Show Gist options
  • Save FeliciousX/11a317ee1faf82036eb6faac5b45f870 to your computer and use it in GitHub Desktop.
Save FeliciousX/11a317ee1faf82036eb6faac5b45f870 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const emailVerificationMachine = Machine({
id: 'emailVerification',
initial: 'idle',
states: {
idle: {
on: { SEND_EMAIL: 'sending' }
},
sending: {
invoke: {
src: 'sendVerification',
onDone: {
target: 'send_success'
},
onError: {
target: 'send_failed'
}
}
},
send_failed: {
after: {
3000: 'sent'
}
},
send_success: {
after: {
6000: 'sent'
}
},
sent: {
on: { SEND_EMAIL: 'sending' }
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment