Last active
August 1, 2019 10:27
-
-
Save NoriSte/bc93fce5af8f6dc6eebd595d2d68ac78 to your computer and use it in GitHub Desktop.
Old Conio BO Auth Flow - 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 fetchMachine = Machine({ | |
id: 'fetch', | |
initial: 'localTokens', | |
context: {}, | |
states: { | |
localTokens: { | |
on: { | |
"EXIST": 'sessionCheck', | |
"NOT.EXIST": 'loginForm' | |
} | |
}, | |
loginForm: { | |
on: { | |
"200": "loginSuccess", | |
"401": "loginForm", | |
"500": "serverError" | |
} | |
}, | |
sessionCheck: { | |
on: { | |
"200": 'loginSuccess', | |
"401": 'refreshToken', | |
"500": 'serverError' | |
} | |
}, | |
loginSuccess: { | |
type: 'final' | |
}, | |
serverError: { | |
type: 'final' | |
}, | |
refreshToken: { | |
on: { | |
"200": "sessionCheck", | |
"401": "loginForm" | |
} | |
} | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment