Skip to content

Instantly share code, notes, and snippets.

@derekr
Created October 17, 2019 18:58
Show Gist options
  • Save derekr/932f6680062e4610a484059b97847b20 to your computer and use it in GitHub Desktop.
Save derekr/932f6680062e4610a484059b97847b20 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: 'session',
initial: 'guest',
context: {
user: null
},
states: {
guest: {
on: {
LOGIN: 'authenticating',
LOGINFB: 'authenticating'
},
},
authenticating: {
on: {
SUCCESS: 'authenticated',
ERROR: 'authenticationError'
}
},
authenticationError: {
on: {
LOGIN: 'authenticating'
}
},
authenticated: {
on: {
SIGNOUT: 'guest'
}
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment