SHARE
TWEET

Untitled

a guest Sep 20th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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: 'fetch',
  14.     initial: 'pending',
  15.     states: {
  16.       pending: {
  17.         on: {
  18.           ANALYSE: 'waiting_for_acceptance',
  19.           REJECT: 'rejected'
  20.         }
  21.       },
  22.       waiting_for_acceptance: {
  23.         on: {
  24.           APPROVE: 'accepted',
  25.           REJECT: 'rejected'
  26.         }
  27.       },
  28.       accepted: {
  29.         on: {
  30.           REJECT: 'rejected'
  31.         }
  32.       },
  33.       rejected: {
  34.         on: {
  35.           RETRY: {
  36.             target: 'pending'
  37.           }
  38.         }
  39.       }
  40.     }
  41.   });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top