Skip to content

Instantly share code, notes, and snippets.

@irishbryan
Last active July 2, 2020 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save irishbryan/44b05ee0f37b4b8f1678363acd906032 to your computer and use it in GitHub Desktop.
Save irishbryan/44b05ee0f37b4b8f1678363acd906032 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({
initial: "idle",
context: {
showForm: false,
formLabel: "",
submitButtonString: "",
},
states: {
idle: {
on: {
EMAIL: "email",
OKTA: "okta",
GOOGLE: "google",
},
},
email: {
entry: assign({
showForm: true,
formLabel: "Sign in with email",
submitButtonString: "Sign in",
}),
on: {
OKTA: "okta",
GOOGLE: "google",
},
},
okta: {
entry: assign({
showForm: true,
formLabel: "Sign in with Okta",
submitButtonString: "Continue to Okta",
}),
on: {
EMAIL: "email",
GOOGLE: "google",
},
},
google: {
entry: [
assign({
showForm: false,
}),
// triggerGoogleOAuthRedirect,
],
on: {
EMAIL: "email",
OKTA: "okta",
},
},
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment