Skip to content

Instantly share code, notes, and snippets.

@boertel
Last active July 2, 2021 19:58
Show Gist options
  • Save boertel/a585f6c58e8490b9a4da1e09fd164bdd to your computer and use it in GitHub Desktop.
Save boertel/a585f6c58e8490b9a4da1e09fd164bdd 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: 'meeting',
initial: 'isAuthenticated',
states: {
isAuthenticated: {
on: {
"LOGGED_IN": 'hasPermissions',
'LOGGED_OUT': "shortSignup"
}
},
hasPermissions: {
on: {
NO: 'askForApproval',
YES: 'meeting',
}
},
askForApproval: {
on: {
REQUEST: "waitForApproval",
LOGOUT: "logout"
}
},
waitForApproval: {
on: {
ACCEPTED: 'meeting',
REJECTED: 'rejected'
}
},
meeting: {
type: 'final'
},
logout: {
type: 'final'
},
rejected: {
type: 'final'
},
shortSignup: {
on: {
SIGNUP: "confirmationPIN"
}
},
confirmationPIN: {
on: {
SUCCESS: "hasPermissions"
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment