Created
September 13, 2019 15:58
-
-
Save trabianmatt/f3c6a4e59ae0c0601c8adf5f26e1f298 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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