Created
March 22, 2021 13:47
-
-
Save joe-bell/7e0d3b43d3945a5843ca034df1684030 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains 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 authMachine = Machine({ | |
id: "authMachine", | |
initial: "idle", | |
context: { | |
message: "Authenticating…", | |
user: null, | |
}, | |
states: { | |
error: {}, | |
idle: { | |
on: { | |
RESOLVE: "authenticating", | |
REJECT: "error", | |
}, | |
}, | |
authenticating: { | |
on: { | |
RESOLVE: "loggedIn", | |
REJECT: "loggedOut", | |
}, | |
}, | |
loggedOut: { | |
entry: "logIn", | |
}, | |
loggedIn: { | |
on: { | |
"": "verifying", | |
}, | |
}, | |
verifying: { | |
on: { | |
RESOLVE: "booting", | |
REJECT: "error", | |
}, | |
}, | |
booting: { | |
on: { | |
RESOLVE: "redirecting", | |
UPDATE: "", | |
REJECT: "error", | |
}, | |
}, | |
redirecting: { | |
type: "final", | |
}, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment