Skip to content

Instantly share code, notes, and snippets.

@vunguyentuan
Created July 6, 2021 09:10
Show Gist options
  • Save vunguyentuan/ce16d6b8fb3b8e13fe21d918c32ff96a to your computer and use it in GitHub Desktop.
Save vunguyentuan/ce16d6b8fb3b8e13fe21d918c32ff96a 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: 'Internship Machine',
initial: 'pending',
context: {
retries: 0
},
states: {
pending: {
on: {
TIMEOUT: 'expired',
APPROVE: 'approved',
REJECT: 'rejected'
}
},
expired: {
on: {
RENEW: 'pending',
REJECT: 'rejected'
}
},
approved: {
on: {
ON_DATE: 'ongoing'
}
},
ongoing: {
on: {
COMPLETE: 'completed',
CANCEL: 'cancelled'
}
},
rejected: {
type: 'final'
},
completed: {
type: 'final'
},
cancelled: {
type: 'final'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment