Created
February 3, 2020 13:02
-
-
Save the-main-thing/9240b33809198b2526ecc5733b596807 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
const fetchMachine = Machine({ | |
id: 'dataBoard', | |
initial: 'idle', | |
context: { | |
currentId: null | |
}, | |
states: { | |
idle: { | |
on: { | |
ADD: 'add', | |
EDIT: 'edit', | |
DELETE: 'confirm_delete' | |
} | |
}, | |
confirm_delete: { | |
on: { | |
DELETE: 'delete', | |
CANCEL: 'idle' | |
} | |
}, | |
'delete': { | |
on: { | |
COMPLETE: 'idle', | |
ERROR: 'error' | |
} | |
}, | |
add: { | |
on: { | |
SAVE: 'saving_new', | |
CANCEL: 'idle' | |
} | |
}, | |
saving_new: { | |
on: { | |
COMPLETE: 'idle', | |
ERROR: 'error' | |
} | |
}, | |
error: { | |
on: { | |
RESET: 'idle' | |
} | |
}, | |
edit: { | |
on: { | |
SAVE: 'saving_change', | |
} | |
}, | |
saving_change: { | |
on: { | |
COMPLETE: 'idle', | |
ERROR: 'error' | |
} | |
} | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment