Created
April 8, 2020 20:43
-
-
Save RafalFilipek/32b1b022995fa767dac52a95639663c1 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or 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 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