Skip to content

Instantly share code, notes, and snippets.

@mhinton
Last active January 21, 2022 17:04
Show Gist options
  • Save mhinton/7adcb62dfa7836d61d771b1ebcc37bde to your computer and use it in GitHub Desktop.
Save mhinton/7adcb62dfa7836d61d771b1ebcc37bde 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: 'fetch',
initial: 'signin',
context: {
retries: 0,
},
states: {
signin: {
on: {
REGISTER: "signup",
SIGNEDIN: "signedin",
RESET: "reset",
CONFIRM: "confirm",
},
},
reset: {
on: {
COMPLETE: "confirm",
},
},
signedin: {
on: {
SIGNOUT: "signin",
PROFILE: "profile",
},
},
signup: {
on: {
COMPLETE: "confirm",
RESET: "signin",
REQUEST: "request",
},
},
request: {
on: {
COMPLETE: "confirm",
},
},
confirm: {
on: {
COMPLETE: "signin",
REQUEST: "request",
},
},
profile: {
on: {
COMPLETE: "signin",
HOME: "signedin",
},
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment