Created
October 19, 2021 12:08
-
-
Save ondrasak/9f276064d813b53c2bcf25d6ef531293 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or 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 AuthenticateMachine = Machine({ | |
| id: 'Authenticate', | |
| initial: 'start', | |
| context: { | |
| retries: 0 | |
| }, | |
| states: { | |
| start: { | |
| on: { | |
| CHECK_OAUTH: 'OAuthCheck' | |
| } | |
| }, | |
| OAuthCheck: { | |
| meta: { | |
| description: 'this chcek by the URL if oAuth is in proggress' | |
| }, | |
| onEntry: ['OAuthCheckHandler'], | |
| on: { | |
| NEXT: [ | |
| { | |
| target: 'OAuthProcess', | |
| cond:'isOauthInProggress' | |
| }, | |
| { | |
| target: 'EventUserAuthentication' | |
| } | |
| ] | |
| } | |
| }, | |
| OAuthProcess: { | |
| onEntry: ['OAuthCheckHandler'] | |
| }, | |
| EventUserAuthentication: {} | |
| } | |
| }, { | |
| actions: { | |
| OAuthCheckHandler: () => { | |
| send('NEXT') | |
| } | |
| }, | |
| guards: { | |
| isOauthInProggress: () => false | |
| } | |
| }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment