Skip to content

Instantly share code, notes, and snippets.

@sukima
Created July 27, 2020 20:52
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 sukima/99a87ce2ea6f3ccc903057938d617d5f to your computer and use it in GitHub Desktop.
Save sukima/99a87ce2ea6f3ccc903057938d617d5f 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: 'exclusion-manager-ioa-exclusion',
initial: 'details',
context: {},
states: {
cancelled: {
type: 'final',
entry: 'closeModal',
},
details: {
entry: ['showExclusionForm', 'showFlashError'],
on: {
NEXT: 'affectedSummary',
PREV: 'cancelled',
}
},
affectedSummary: {
entry: ['showAffectedSummary', 'showFlashError'],
on: {
NEXT: 'confirmation',
PREV: 'details',
},
},
confirmation: {
entry: ['showConfirmation', 'hideFlashError'],
on: {
NEXT: 'saving',
PREV: 'affectedSummary',
},
},
saving: {
entry: ['showLoadingIndicator', 'hideFlashError'],
invoke: { src: 'saveExclusion' },
on: {
PREV: 'cancelled',
DONE: {
target: 'confirmed',
actions: ['clearError', 'cacheResult'],
},
ERROR: {
target: 'affectedSummary',
actions: ['cacheError', 'captureError'],
},
},
},
confirmed: {
type: 'final',
entry: ['announceGlobalSuccessFlashMessage', 'closeModal'],
},
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment