Skip to content

Instantly share code, notes, and snippets.

@bearkfear
Created April 26, 2021 00:56
Show Gist options
  • Save bearkfear/4f3fb8b8a73055692237572642deee42 to your computer and use it in GitHub Desktop.
Save bearkfear/4f3fb8b8a73055692237572642deee42 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 fetchMachine = Machine({
id: "login-machine",
initial: "idle",
states: {
idle: {
on: {
START_LOGIN: "authenticating",
},
},
authenticating: {
id: "loginUser",
invoke: {
src: 'signInAsync',
onDone: {
target: "success",
actions: "saveAndNavigate",
},
onError: {
target: "error",
},
},
},
success: {
type: "final"
},
error: {
on: {
START_LOGIN: "authenticating",
},
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment