Skip to content

Instantly share code, notes, and snippets.

@ryan-mars
Created March 22, 2021 19:09
Show Gist options
  • Save ryan-mars/b582be251bb71c136dba6ecac2271386 to your computer and use it in GitHub Desktop.
Save ryan-mars/b582be251bb71c136dba6ecac2271386 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: 'UI',
initial: 'loading',
states: {
loading: {
on: {
AUTHED: 'authenticated',
UNAUTHED: 'unauthenticated'
}
},
authenticated: {
on: {
SUBSCRIBED: 'dashboard',
NOT_SUBSCRIBED: 'subscribe'
}
},
dashboard: {
type: 'final'
},
subscribe: {
on: {
SUBSCRIBED: 'dashboard'
}
},
unauthenticated: {
on: {LOGIN: 'authenticated'}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment