Skip to content

Instantly share code, notes, and snippets.

@RafalFilipek
Last active April 7, 2020 14:41
Show Gist options
  • Save RafalFilipek/855d96cd38aba799c42c6b7b6878b2ce to your computer and use it in GitHub Desktop.
Save RafalFilipek/855d96cd38aba799c42c6b7b6878b2ce to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const m = Machine({
initial: "initializing",
states: {
initializing: {
invoke: {
src: "fetch",
onDone: "ready",
},
},
ready: {
entry: "selectDefaultAccount",
states: {
idle: {
on: {
SELECT: {
actions: "selectAccount",
target: "confirming",
},
},
},
confirming: {
on: {
CANCEL: { target: "idle" },
CONFIRM: { target: "processing" },
},
},
processing: {
invoke: {
src: "doStuff",
onDone: {
actions: "saveTransactions",
target: "#success",
},
onError: {
target: "error",
actions: "setError",
},
},
},
error: {},
},
},
success: { id: "success", type: "final", data: () => true },
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment