Skip to content

Instantly share code, notes, and snippets.

@awb305
Created December 1, 2019 16:03
Show Gist options
  • Select an option

  • Save awb305/25d4d8098ab3ed39f0e34942ad8b673a to your computer and use it in GitHub Desktop.

Select an option

Save awb305/25d4d8098ab3ed39f0e34942ad8b673a 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: 'Authentication',
initial: 'GetInitialProps',
states: {
GetInitialProps: {
on: {
getTokenAndUser: 'fetchingUser'
}
},
fetchingUser: {
on: {
loggedIn: 'SSRAppTree',
loggedOut: 'RenderLogin'
}
},
SSRAppTree: {
on: {
success: 'RenderUserAndApollo',
error: 'useEffectFirebase',
}
},
useEffectFirebase: {
on: {
waiting: 'RenderWithoutProviders',
}
},
RenderWithoutProviders: {
on: {
loggedIn: 'RenderUserAndApollo',
loggedOut: 'RenderLogin'
}
},
RenderLogin: {
type: 'final'
},
RenderUserAndApollo: {
type: 'final'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment