Skip to content

Instantly share code, notes, and snippets.

@RafalFilipek
Created April 9, 2020 10:27
Show Gist options
  • Save RafalFilipek/6e02c17ceaaf2d6f1f7375a5a9c821d0 to your computer and use it in GitHub Desktop.
Save RafalFilipek/6e02c17ceaaf2d6f1f7375a5a9c821d0 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const m = Machine({
initial: "initializing",
context: {
processing: false,
},
states: {
initializing: {
invoke: {
src: "fetchAccounts",
onDone: { target: "ready" },
},
},
ready: {
entry: "selectDefaultAccount",
on: { SELECT: { target: ".selected" } },
initial: "idle",
states: {
idle: {},
selected: {
on: {
CONFIRM: {
target: "updating",
},
},
},
updating: {
invoke: {
src: "update",
onDone: { target: "#success" },
onError: { target: "failed", actions: "setError" },
},
},
failed: {},
},
},
success: {
id: "success",
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment