Skip to content

Instantly share code, notes, and snippets.

@basanth-ivoyant
Created October 21, 2020 15:22
Show Gist options
  • Save basanth-ivoyant/2b0dd03cd9daf5b509c7ce56c9f3721a to your computer and use it in GitHub Desktop.
Save basanth-ivoyant/2b0dd03cd9daf5b509c7ce56c9f3721a 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": "SingleStepProcess",
"initial": "selectAction",
"context": {},
"states": {
"selectAction": {
"on": {
"SUBMIT": "submit",
"CANCEL": "cancel"
}
},
"submit": {
"invoke": {
"id": "helpers-invokeService",
"src": "helpers-invokeService",
"onDone": {
"actions": [
{ "type": "helpers-log", "data": "onDone" }
],
"target": "success"
},
"onError": {
"actions": [
{ "type": "helpers-log", "data": "onError" }
],
"target": "error"
}
}
},
"error": {
"entry": [{ "type": "helpers-log" }],
"on": {
"SUBMIT": "submit",
"CANCEL": "cancel"
}
},
"success": {
"type": "final"
},
"cancel": {
"entry": [{ "type": "helpers-log" }],
"type": "final"
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment