Skip to content

Instantly share code, notes, and snippets.

@joe-bell
Created March 22, 2021 13:47
Show Gist options
  • Save joe-bell/7e0d3b43d3945a5843ca034df1684030 to your computer and use it in GitHub Desktop.
Save joe-bell/7e0d3b43d3945a5843ca034df1684030 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 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