Skip to content

Instantly share code, notes, and snippets.

@gertig
Created June 23, 2020 01:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gertig/f3bff09b5f88f6ba531fc380055e51fb to your computer and use it in GitHub Desktop.
Save gertig/f3bff09b5f88f6ba531fc380055e51fb to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const integrationMachine = Machine({
id: "integration",
initial: "noAuthorization",
states: {
noAuthorization: {
on: {
OAUTH_SUCCESS: "needsSiteSelection",
HAS_SITE: "needsCollectionSelection",
HAS_COLLECTION: "needsFieldMapping",
},
},
needsSiteSelection: {
on: {
GET_SITES_REQUESTED: "loadingSites",
SITE_SELECTED: "needsCollectionSelection",
},
},
loadingSites: {
on: {
GET_SITES_SUCCESS: "needsSiteSelection",
GET_SITES_FAILURE: "needsSiteSelection",
},
},
needsCollectionSelection: {
on: {
GET_COLLECTIONS_REQUESTED: "loadingCollections",
COLLECTION_SELECTED: "needsFieldMapping",
},
},
needsFieldMapping: {},
loadingCollections: {
on: {
// GET_SITES_SUCCESS: "noSiteSaved",
},
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment