Skip to content

Instantly share code, notes, and snippets.

@basanth-ivoyant
Last active October 5, 2020 01:56
Show Gist options
  • Save basanth-ivoyant/9e29af302917c6b769968308020ff39d to your computer and use it in GitHub Desktop.
Save basanth-ivoyant/9e29af302917c6b769968308020ff39d 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 machine = Machine({
id:"form",
initial: "start",
context: {
retries: 0
},
states: {
start: {
on: {
SENDCODE:"sendCode"
}
},
sendCode: {
on: {
SUBMITCODE: "submitCode"
}
},
submitCode: {
on: {
CODEREJECTED: "sendCode",
CODEACCEPTED: "takePayment"
}
},
takePayment: {
on: {
SUBMITPAYMENT: "submitPayment"
}
},
submitPayment: {
on: {
PAYMENTFAILURE: "takePayment",
PAYMENTSUCCESS: "confirmation"
}
},
confirmation: {
type: "final"
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment