Created
January 6, 2023 18:52
-
-
Save nathaniel-miller/e8178e1802bc0b4f7f064d8ec40d6b1a to your computer and use it in GitHub Desktop.
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 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