Skip to content

Instantly share code, notes, and snippets.

@fakenickels
Created October 23, 2019 13:47
Show Gist options
  • Save fakenickels/7d8a721a76df4f6c92847ce5ca7a4403 to your computer and use it in GitHub Desktop.
Save fakenickels/7d8a721a76df4f6c92847ce5ca7a4403 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: 'contactCare',
initial: 'idle',
context: {
retries: 0
},
states: {
idle: {
on: {
NEXT: 'prontmedModal'
}
},
prontmedModal: {
on: {
NEXT: 'notesModal',
CANCEL: 'idle'
}
},
notesModal: {
type: 'final'
},
failure: {
on: {
RETRY: {
target: 'idle',
actions: assign({
retries: (context, event) => context.retries + 1
})
}
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment