Skip to content

Instantly share code, notes, and snippets.

@achambers
Last active June 4, 2021 12:30
Show Gist options
  • Select an option

  • Save achambers/24f2c93ceb1497f35ee48cde9de527a1 to your computer and use it in GitHub Desktop.

Select an option

Save achambers/24f2c93ceb1497f35ee48cde9de527a1 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: 'appointment status',
initial: 'reserved',
states: {
reserved: {
on: {
BOOK: 'booked',
CANCEL: 'cancelled',
SUPERCEDE: 'superceded'
},
},
booked: {
on: {
CHECK_IN: 'checkedIn',
PAYMENT: 'paid',
CANCEL: 'cancelled',
}
},
checkedIn: {
on: {
UNDO_CHECK_IN: 'booked',
PAY: 'paid',
CANCEL: 'cancelled',
}
},
paid: {
type: 'final',
on: {
UNDO_PAYMENMT: 'booked',
}
},
superceded: {
type: 'final'
},
cancelled: {
type: 'final'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment