Last active
August 23, 2021 20:32
-
-
Save onurkose/8cf151e21dc41d12845c44a03372e951 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({ | |
id: 'shop-creation', | |
initial: 'pendingFormSent', | |
states: { | |
pendingFormSent: { | |
on: { | |
CREATE_WORKSPACE: 'createWorkspace', | |
CREATE_SHOP: 'createShop', | |
}, | |
}, | |
createWorkspace: { | |
invoke: { | |
src: 'execCreateWorkspace', | |
onDone: { | |
target: 'includeUserToWorkspace', | |
}, | |
onError: { | |
target: 'createWorkspaceError', | |
}, | |
}, | |
}, | |
includeUserToWorkspace: { | |
invoke: { | |
src: 'execIncludeUserToWorkspace', | |
onDone: { | |
target: 'createShop', | |
}, | |
onError: { | |
target: 'includeUserToWorkspaceError', | |
}, | |
}, | |
}, | |
createShop: { | |
invoke: { | |
src: 'execCreateShop', | |
onDone: { | |
target: 'shopCreated', | |
}, | |
onError: { | |
target: 'createShopError', | |
}, | |
}, | |
}, | |
shopCreated: { | |
type: 'final', | |
}, | |
createShopError: { | |
on: { | |
RETRY_CREATE_SHOP: 'createShop', | |
}, | |
}, | |
createWorkspaceError: { | |
on: { | |
RETRY_CREATE_WORKSPACE: 'createWorkspace', | |
}, | |
}, | |
includeUserToWorkspaceError: { | |
on: { | |
RETRY_INCLUDE_USER_TO_WORKSPACE: 'includeUserToWorkspace', | |
}, | |
}, | |
}, | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment