Skip to content

Instantly share code, notes, and snippets.

@GiancarlosIO
Last active July 30, 2020 16:49
Show Gist options
  • Save GiancarlosIO/c9e3639fdc443254e8b543d4c0166c5e to your computer and use it in GitHub Desktop.
Save GiancarlosIO/c9e3639fdc443254e8b543d4c0166c5e to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const fetchMachine = Machine({
id: 'projectUpload',
initial: 'COURSE_DASHBOARD',
context: {
retries: 0
},
states: {
COURSE_DASHBOARD: {
on: {
CLICK_UPLOAD: 'project_building_editor'
}
},
project_building_editor: {
on: {
SAVE: 'loading',
}
},
loading: {
on: {
RESOLVE: 'success',
REJECT: 'failure'
}
},
failure: {
on: {
RETRY: {
target: 'loading',
}
}
},
success: {
on: {
ASK_FOR_FEEDBACK: 'verify_project',
KEEP_EDITING: 'project_building_editor',
}
},
verify_project: {
on: {
VALID: 'ASK_FOR_FEEDBACK_DIALOG',
INVALID: 'project_invalid_popup',
}
},
ASK_FOR_FEEDBACK_DIALOG: {
},
project_invalid_popup: {
on: {
OK: 'project_building_editor'
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment