Last active
July 2, 2020 18:52
-
-
Save irishbryan/44b05ee0f37b4b8f1678363acd906032 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({ | |
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