Skip to content

Instantly share code, notes, and snippets.

@NoriSte
Last active August 1, 2019 10:27
Show Gist options
  • Save NoriSte/bc93fce5af8f6dc6eebd595d2d68ac78 to your computer and use it in GitHub Desktop.
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
// 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