Skip to content

Instantly share code, notes, and snippets.

@ksm
Created September 29, 2020 16:23
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 ksm/6b94ed614747c3508a5c448406d232b5 to your computer and use it in GitHub Desktop.
Save ksm/6b94ed614747c3508a5c448406d232b5 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 signUpMachine = Machine({
id: 'sign-up-flow',
initial: 'invite_code',
context: {
invite_code: null,
phone_number: null,
email: null
},
states: {
invite_code: {
on: {
ENTER_CODE: 'phone_number',
NO_CODE: 'waitlist'
}
},
phone_number: {
on: {
ENTER_PHONE: 'email',
}
},
email: {
on: {
ENTER_EMAIL: 'password',
// now if email exists or not depends
}
},
password: {
on: {
ENTER_PASSWORD: 'logged_in_home'
}
},
logged_in_home: {
type: 'final'
},
waitlist: {
on: {
ENTER_EMAIL: 'waitlist_success'
}
},
waitlist_success: {}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment