Skip to content

Instantly share code, notes, and snippets.

@tbigueres
Created December 2, 2019 23:32
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 tbigueres/b0a73f0684d962ed457625e658ede860 to your computer and use it in GitHub Desktop.
Save tbigueres/b0a73f0684d962ed457625e658ede860 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)
function paymentStatusWaitingForMoreInformation(context) {
if(context.status == "PAYMENT_WAITING_FOR_MORE_INFORMATION");
}
function paymentStatusWaitingForReconciliation(context) {
if(context.status == "PAYMENT_WAITING_FOR_RECONCILIATION");
}
function changeState(context) {
}
const fetchMachine = Machine({
id: 'clientPaymentDrawer',
initial: 'idle',
context: {
status: "PAYMENT_WAITING_FOR_MORE_INFORMATION"
},
states: {
idle: {
on: {
OPEN: [{
on: "paymentStatusWaitingForMoreInformation",
target:"choose_a_client_screen"
}, {
on: "paymentStatusWaitingForReconciliation",
target:"waiting_for_reconciliation_screen"
},
]
}
},
choose_a_client_screen: {
on: {
CHOOSE_THE_CLIENT: 'validate_the_client_screen',
CANCEL: 'idle'
}
},
validate_the_client_screen: {
on: {
CLICK_ON_VALIDATE: "validating_the_client_call" ,
CANCEL: "idle"
}
},
validating_the_client_call: {
on: {
VALIDATED: "waiting_for_reconciliation_screen" ,
}
},
waiting_for_reconciliation_screen: {
on: {
EDIT_THE_CLIENT: 'choose_a_client_screen'
}
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment