Created
October 20, 2020 16:14
-
-
Save betocantu93/d18df9a19c170ff32835d9d2be174e61 to your computer and use it in GitHub Desktop.
Revisions
-
betocantu93 created this gist
Oct 20, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,102 @@ // Available variables: // - Machine // - interpret // - assign // - send // - sendParent // - spawn // - raise // - actions // - XState (all XState exports) const fetchMachine = Machine({ id: "action", initial: "created", states: { created: { on: { ASSIGN: "pending", CANCEL: "canceled", }, meta: { ASSIGN: {}, CANCEL: { type: "warn", icon: "cancel", }, }, }, pending: { on: { START: "in_progress", CANCEL: "canceled", }, meta: { START: {}, CANCEL: { type: "warn", icon: "cancel", }, }, }, in_progress: { on: { PROPOSE: "ready", CANCEL: "canceled", }, meta: { PROPOSE: { type: "primary", }, CANCEL: { type: "warn", icon: "cancel", }, }, }, ready: { on: { DECLINE: "declined", CLOSE: "done", CANCEL: "canceled", }, meta: { DECLINE: {}, CLOSE: {}, CANCEL: { type: "warn", icon: "cancel", }, }, }, declined: { on: { CORRECT: "in_progress", CANCEL: "canceled", }, meta: { CORRECT: {}, CANCEL: { type: "warn", icon: "cancel", }, }, }, canceled: { on: { ENABLE: "created", }, meta: { ENABLE: { icon: "restore", }, }, }, done: { type: "final", }, } } );