Last active
October 28, 2020 10:04
-
-
Save samzmann/c8e8bbb446fcb9494602a86a1ead7e1a 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 evts = { | |
} | |
const fetchMachine = Machine({ | |
id: 'Get Help Modal', | |
initial: 'articles', | |
context: { | |
errorMessage: null | |
}, | |
states: { | |
articles: { | |
on: { | |
NAV_BOWL_ISSUE: 'articleBowlIssue', | |
NAV_CREDITS: 'articleCredits', | |
NAV_GENERAL_HELP: 'generalHelpForm', | |
} | |
}, | |
articleBowlIssue: { | |
on: { | |
BACK: 'articles', | |
NEXT: 'reportSelectBowls' | |
} | |
}, | |
articleCredits: { | |
on: { | |
BACK: 'articles', | |
}, | |
}, | |
articleCredits: { | |
on: { | |
BACK: 'articles', | |
}, | |
}, | |
generalHelpForm: { | |
on: { | |
BACK: 'articles', | |
} | |
}, | |
reportSelectBowls: { | |
on: { | |
BACK: 'articleBowlIssue', | |
NEXT: 'reportForm' | |
} | |
}, | |
reportForm: { | |
on: { | |
BACK: 'reportSelectBowls', | |
NEXT: 'reportSuccess', | |
ERROR: { | |
actions: assign({ | |
errorMessage: (ctx,evt) => evt.errorMessage || 'Something went wrong' | |
}), | |
} | |
}, | |
exit: assign({ errorMessage: () => null }), | |
}, | |
reportSuccess: { | |
type: 'final' | |
} | |
}, | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment