Skip to content

Instantly share code, notes, and snippets.

@sergiokopplin
Last active July 28, 2020 02:17
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 sergiokopplin/f7be65a1ef119ee01fec44ce00b5313d to your computer and use it in GitHub Desktop.
Save sergiokopplin/f7be65a1ef119ee01fec44ce00b5313d to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: 'importer',
initial: 'idle',
states: {
idle: {
on: {
start: 'registration',
},
},
registration: {
initial: 'command',
states: {
command: {
initial: 'idle',
states: {
idle: {
on: {
start: 'running'
}
},
running: {
on: {
success: 'success',
error: '#failure'
}
},
success: {
on: {
done: '#searching-registration'
}
},
},
},
searching: {
id: 'searching-registration',
initial: 'idle',
states: {
idle: {
on: {
start: 'running'
}
},
running: {
on: {
success: 'success',
error: '#failure'
}
},
success: {
on: {
done: '#report-registration'
}
},
},
},
report: {
id: 'report-registration'
},
},
},
transaction: {
id: 'transaction',
initial: 'command',
states: {
command: {
id: 'command',
initial: 'idle',
states: {
idle: {},
running: {},
success: {},
},
},
searching: {
initial: 'idle',
states: {
idle: {},
running: {},
success: {},
},
},
report: {},
},
},
report: {
id: '#report',
type: 'final',
},
failure: {
type: 'final',
id: 'failure',
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment