Skip to content

Instantly share code, notes, and snippets.

@RafalFilipek
Created April 8, 2020 20:43
Show Gist options
  • Save RafalFilipek/32b1b022995fa767dac52a95639663c1 to your computer and use it in GitHub Desktop.
Save RafalFilipek/32b1b022995fa767dac52a95639663c1 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const m = Machine({
initial: 'initializing',
context: {
processing: false
},
states: {
initializing: {
invoke: {
src: 'fetchAccounts',
onDone: { target: 'ready' }
}
},
ready: {
entry: 'selectDefaultAccount',
on: { SELECT: { target: '.selected' } },
initial: 'idle',
states: {
idle: {},
selected: {
on: {
CONFIRM: {
target: 'updating'
}
}
},
updating: {
invoke: {
src: 'update',
onDone: { target: '#success' },
onError: { target: 'failed', actions: 'setError' }
}
},
failed: {}
}
},
success: {
id: 'success'
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment