Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Available variables:
- // - Machine
- // - interpret
- // - assign
- // - send
- // - sendParent
- // - spawn
- // - raise
- // - actions
- // - XState (all XState exports)
- const fetchMachine = Machine({
- id: 'TechBar',
- initial: 'initial',
- context: {
- retries: 0
- },
- states: {
- initial: {
- on: {
- BADGE_IN: 'badgingIn'
- }
- },
- badgingIn: {
- on: {
- SELECT_EXISTING: 'chooseExisting',
- CREATE_NEW: 'createNew'
- }
- },
- chooseExisting: {
- on: {
- CONFIRM: 'addToQueue'
- }
- },
- createNew: {
- on: {
- PROVIDE_DETAILS: 'createAndAdd'
- }
- },
- createAndAdd: {
- on: {
- SUCCESS: 'addToQueue',
- FAILURE: 'badgingIn'
- }
- },
- addToQueue: {
- on: {
- SUCCESS: 'inQueue',
- FAILURE: 'badgingIn'
- }
- },
- inQueue: {
- on: {
- AGENT_TAKE: 'agentTake',
- AGENT_KICK: 'agentKick'
- }
- },
- agentKick: {
- type: 'final'
- },
- agentTake: {
- on: {
- RESOLVE: 'issueResolved',
- PAUSE: 'issuePaused',
- CANCEL: 'issueCanceled'
- }
- },
- issueResolved: {
- type: 'final'
- },
- issuePaused: {
- type: 'final'
- },
- issueCanceled: {
- type: 'final'
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement