Skip to content

Instantly share code, notes, and snippets.

@raphaeltraviss
Created March 4, 2021 22:46
Show Gist options
  • Save raphaeltraviss/b652aa25a9fb5a7d5d2c74288fe8961a to your computer and use it in GitHub Desktop.
Save raphaeltraviss/b652aa25a9fb5a7d5d2c74288fe8961a 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: 'only_plaid',
initial: 'plaidActive',
states: {
plaidActive: {
on: {
OPEN_PLAID: 'plaidOpen',
},
},
plaidOpen: {
entry: 'openPlaid',
on: {
PLAID_EXIT: {
target: "plaidActive",
actions: "closeModals",
},
PLAID_ERROR: {
target: "plaidActive",
actions: ["flashMessage", "closeModals"],
},
PLAID_SUCCESS: {
target: "debtleLoading",
actions: ["flashMessage"],
},
},
},
debtleLoading: {
invoke: {
id: 'attemptSaveBankAccount',
src: (_ctx, ev) => attemptSaveBankAccount(ev.formData),
onDone: {
target: 'plaidActive',
actions: ["flashMessage", "updateButton", "closeModals"],
},
onError: {
target: "plaidActive",
actions: ["flashMessage", "closeModals"],
},
},
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment