Skip to content

Instantly share code, notes, and snippets.

@tanhauhau
Created June 28, 2020 07:30
Show Gist options
  • Save tanhauhau/4db357b6e736d471e6b051d04b769755 to your computer and use it in GitHub Desktop.
Save tanhauhau/4db357b6e736d471e6b051d04b769755 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: 'fetch',
initial: 'draft',
context: {
retries: 0
},
states: {
draft: {
on: {
"NEW": 'pending_approve',
"SAVE": "draft"
}
},
pending_approve: {
on: {
APPROVE: 'approved',
REJECT: 'cancelled'
}
},
approved: {
on: {
ACCEPT: 'accepted',
DECLINE: 'declined',
CANCEL: 'cancelled',
}
},
accepted: {
type: 'final',
},
declined: {
type: 'final',
},
cancelled: {
type: 'final',
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment