Created
July 15, 2020 08:54
-
-
Save raphaelbadia/62f6604d1666e68272b3e6ccb5bf391a 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
const mainMachine = Machine({ | |
id: 'main', | |
initial: 'idle', | |
context: { | |
// retries: 0 | |
}, | |
states: { | |
idle: { | |
on: { | |
START: 'start' | |
} | |
}, | |
error: { | |
// on: { | |
// RETRY: 'unauthorized' | |
// } | |
}, | |
start: { | |
invoke: { | |
src: "getCachedCredentials", | |
onDone: { target: "login" }, | |
onError: { target: "unauthorized", actions: "onError" }, | |
} | |
}, | |
unauthorized: { | |
on: { | |
LOGIN: 'login' | |
}, | |
}, | |
login: { | |
invoke: { | |
src: "proceedLogin", | |
onDone: { target: "working", actions: "onSuccess" }, | |
onError: { target: "unauthorized", actions: "onError" }, | |
} | |
}, | |
working: { | |
states: { | |
}, | |
}, | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment