Skip to content

Instantly share code, notes, and snippets.

@nathaniel-miller
Created January 6, 2023 18:52
Show Gist options
  • Save nathaniel-miller/e8178e1802bc0b4f7f064d8ec40d6b1a to your computer and use it in GitHub Desktop.
Save nathaniel-miller/e8178e1802bc0b4f7f064d8ec40d6b1a 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 accessPoliciesMachine = Machine({
id: 'accessPolicies',
initial: 'idle',
states: {
idle: {
on: {
SHOW_CREATE_POLICY_MODAL: {
target: 'showingCreatePolicyModal',
},
},
},
showingCreatePolicyModal: {
on: {
CANCEL: {
target: 'idle',
},
CONFIRM: {
target: 'submittingNewPolicy',
},
},
},
submittingNewPolicy: {
invoke: {
id: 'createAccessPolicy',
src: 'createAccessPolicy',
onDone: {
target: 'idle'
},
onError: {
target: 'showingCreatePolicyModal',
}
}
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment