Last active
May 12, 2020 03:20
-
-
Save FeliciousX/11a317ee1faf82036eb6faac5b45f870 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains 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
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