Skip to content

Instantly share code, notes, and snippets.

@mateatslc
Created March 30, 2020 16:57
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 mateatslc/d538b3bdc7cdebafdd9608509de5cd27 to your computer and use it in GitHub Desktop.
Save mateatslc/d538b3bdc7cdebafdd9608509de5cd27 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: 'video',
initial: 'petting',
states: {
petting: {
initial: 'check_token',
states: {
check_token: {
initial: 'waiting_for_response',
states: {
waiting_for_response: {
on: {
GOT_SESSION_ID: 'token_valid',
GOT_ERROR: 'token_invalid',
},
},
token_valid: {
on: {
'': '..waiting_for_legals',
},
},
token_invalid: {
type: 'final',
},
},
},
waiting_for_legals: {
on: {
LEGALS_ACCEPTED: 'ready',
},
},
ready: {
on: {
PREVIEW_REQUESTED: 'preview',
},
},
preview: {
on: {
CALL_REQUESTED: '..act',
},
},
},
},
act: {
initial: 'waiting_for_operator',
states: {
waiting_for_operator: {
on: {
CONNECTED: 'the_call',
},
},
the_call: {
on: {
FINISHED: '..after',
},
},
},
},
after: {
initial: 'review_experience',
states: {
review_experience: {
type: 'final',
},
},
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment