Skip to content

Instantly share code, notes, and snippets.

@laurazenc
Created June 14, 2022 11:05
Show Gist options
  • Save laurazenc/b628a7cc2ee84e1fa79d6ab73146748f to your computer and use it in GitHub Desktop.
Save laurazenc/b628a7cc2ee84e1fa79d6ab73146748f 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 fetchMachine = Machine({
id: 'claimsMachine',
initial: 'idle',
context: { created: [], failed: [], selected: [] },
states: {
idle: {
on: {
BULK: 'bulk',
},
},
bulk: {
initial: 'loading',
states: {
idle: {
on: {
BULK: 'loading',
},
},
loading: {
invoke: {
src: 'bulkClaims',
onDone: {
target: 'success',
actions: 'setData',
},
onError: {
target: 'idle',
actions: 'setError',
},
},
},
success: {
on: {
BULK: 'loading',
},
entry: 'showNotification',
},
},
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment