Created
February 5, 2021 19:27
-
-
Save diestrin/eebf7106e51459f972dececc28b8ee48 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
const fetchMachine = Machine({ | |
context: { | |
codes: undefined, | |
createDateTime: Date.now(), | |
expireDateTime: undefined, | |
id: 'schedule-1234', | |
preparer: 'preparer-12345', | |
enduser: 'endUser-1234', | |
scheduleName: "Doe J" | |
}, | |
initial: 'open', | |
states: { | |
open: { | |
on: { | |
DO_CLOSE: { | |
target: 'close', | |
actions: ['statusClose'] | |
}, | |
DO_CANCELLED: { | |
target: 'cancelled', | |
actions: ['reply'] | |
}, | |
DO_TRANSACTION: { | |
target: 'dispenseAction', | |
actions: ['dispenseAction'] | |
} | |
} | |
}, | |
dispenseAction: { | |
invoke: { | |
id: 'dispense-process', | |
src: 'invokeFlow' | |
}, | |
on: { | |
REPLY: { | |
target: 'open', | |
actions: ['reply'] | |
} | |
} | |
}, | |
close: { | |
invoke: { | |
id: 'close-process', | |
src: 'closeSchedule', | |
onDone: { | |
target: 'closed' | |
}, | |
onError: { | |
target: 'open', | |
actions: ['genericErr'] | |
} | |
} | |
}, | |
closed: { | |
meta: { | |
message: 'The schedule is closed!' | |
}, | |
entry: ['reply'] | |
}, | |
cancelled: { | |
meta: { | |
message: 'The schedule is cancelled!' | |
}, | |
entry: ['reply'] | |
} | |
} | |
} | |
); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment