Created
September 30, 2020 11:27
-
-
Save faneder/3d200f52391cbfc8b85a3a638db3f587 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
const isAllRejected = () => {} | |
const isAllSucceed = () => {} | |
const assignCounts = () => {} | |
const assignErrorMessages = () => {} | |
const fetchMachine = Machine({ | |
id: 'home', | |
initial: 'loading', | |
context: { | |
capGuardrailsWorkItemsCount: undefined, | |
newModelPriceWorkItemsCount: undefined, | |
modelPricePeerReviewWorkItemsCount: undefined, | |
colourLeverPeerReviewWorkItemsCount: undefined, | |
missingLeverWorkItemsCount: undefined, | |
missingLcvPriceWorkItemsCount: undefined, | |
overAgeCarWorkItemsCount: undefined, | |
nearlyNewCarWorkItemsCount: undefined, | |
errorMessages: undefined, | |
}, | |
states: { | |
loading: { | |
invoke: { | |
id: 'getWorkItems', | |
src: () => { | |
return Promise.allSettled([ | |
]); | |
}, | |
onDone: [ | |
{ | |
target: 'worklistsError', | |
cond: isAllRejected, | |
}, | |
{ | |
target: 'displayWorklists.default', | |
cond: isAllSucceed, | |
actions: 'assignCounts', | |
}, | |
{ | |
target: 'displayWorklists.worklistError.active', | |
actions: ['assignErrorMessages', 'assignCounts'], | |
}, | |
], | |
}, | |
}, | |
displayWorklists: { | |
id: 'displayWorklists', | |
type: 'parallel', | |
states: { | |
default: {}, | |
autoRefresh: {}, | |
worklistError: { | |
initial: 'inactive', | |
states: { | |
active: {}, | |
inactive: {}, | |
}, | |
}, | |
}, | |
}, | |
emptyWorklists: {}, | |
worklistsError: {}, | |
}, | |
}, { actions: { assignCounts, assignErrorMessages } }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment