Skip to content

Instantly share code, notes, and snippets.

@trabianmatt
Created September 13, 2019 15:58
Show Gist options
  • Save trabianmatt/f3c6a4e59ae0c0601c8adf5f26e1f298 to your computer and use it in GitHub Desktop.
Save trabianmatt/f3c6a4e59ae0c0601c8adf5f26e1f298 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({
key: "session",
initial: "initializing",
states: {
initializing: {
invoke: {
src: "checkExistingSession",
onDone: "complete",
onError: "checkingExistingAutomaticLogin",
},
},
checkingExistingAutomaticLogin: {
invoke: {
src: "checkExistingAutomaticLogin",
onError: "intro",
onDone: "complete",
},
},
intro: {
onEntry: "showIntro",
on: { REGISTER: "registering" },
},
complete: {
onEntry: "showMainApp",
},
registering: {
initial: "entry",
on: {
REGISTRATION_CLOSED: "intro",
},
onDone: "complete",
states: {
entry: {
onEntry: "showSignup",
on: {
LOGIN_WITH_FACEBOOK: "loggingInWithFacebook",
LOGIN_WITH_GOOGLE: "loggingInWithGoogle",
},
},
loggingInWithFacebook: {
invoke: {
src: "logInWithFacebook",
onDone: "done",
onError: "entry",
},
},
loggingInWithGoogle: {
invoke: {
src: "logInWithGoogle",
onDone: "done",
onError: "entry",
},
},
done: {
type: "final",
},
},
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment