Advertisement
Guest User

Untitled

a guest
Sep 20th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. // Available variables:
  2. // - Machine
  3. // - interpret
  4. // - assign
  5. // - send
  6. // - sendParent
  7. // - spawn
  8. // - raise
  9. // - actions
  10. // - XState (all XState exports)
  11.  
  12. const fetchMachine = Machine({
  13. id: 'TechBar',
  14. initial: 'initial',
  15. context: {
  16. retries: 0
  17. },
  18. states: {
  19. initial: {
  20. on: {
  21. BADGE_IN: 'badgingIn'
  22. }
  23. },
  24. badgingIn: {
  25. on: {
  26. SELECT_EXISTING: 'chooseExisting',
  27. CREATE_NEW: 'createNew'
  28. }
  29. },
  30. chooseExisting: {
  31. on: {
  32. CONFIRM: 'addToQueue'
  33. }
  34. },
  35. createNew: {
  36. on: {
  37. PROVIDE_DETAILS: 'createAndAdd'
  38. }
  39. },
  40. createAndAdd: {
  41. on: {
  42. SUCCESS: 'addToQueue',
  43. FAILURE: 'badgingIn'
  44. }
  45. },
  46. addToQueue: {
  47. on: {
  48. SUCCESS: 'inQueue',
  49. FAILURE: 'badgingIn'
  50. }
  51. },
  52. inQueue: {
  53. on: {
  54. AGENT_TAKE: 'agentTake',
  55. AGENT_KICK: 'agentKick'
  56. }
  57. },
  58. agentKick: {
  59. type: 'final'
  60. },
  61. agentTake: {
  62. on: {
  63. RESOLVE: 'issueResolved',
  64. PAUSE: 'issuePaused',
  65. CANCEL: 'issueCanceled'
  66. }
  67. },
  68. issueResolved: {
  69. type: 'final'
  70. },
  71. issuePaused: {
  72. type: 'final'
  73. },
  74. issueCanceled: {
  75. type: 'final'
  76. }
  77. }
  78. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement