This file contains 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 |
This file contains 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 |
This file contains 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
const addItemToCart = (ctx, item) => | |
new Promise ((resolve, reject) => { | |
const newItem = [{ | |
id: ctx.items.length + 1, | |
name: item.name, | |
price: item.price, | |
quantity: item.quantity | |
}] | |
const items = [...ctx.items, ...newItem] |
This file contains 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
const challengeStates = { | |
initial: "noMFA", | |
states: { | |
noMFA: { | |
on: { | |
"": [{ target: "#amplifyAuth.signIn.roleCheck" }], | |
}, | |
}, | |
mfaSetup: {}, | |
softwareTokenMFA: {}, |
This file contains 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
const applicationMachine = Machine({ | |
id: 'application', | |
initial: 'idle', | |
context: {}, | |
states: { | |
idle: { | |
on: { | |
FETCH: 'loading' | |
} | |
}, |
This file contains 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
const applicationMachine = Machine({ | |
id: 'application', | |
initial: 'idle', | |
context: {}, | |
states: { | |
idle: { | |
on: { | |
FETCH: 'loading' | |
} | |
}, |
This file contains 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
const formMachine = Machine({ | |
id: 'form', | |
initial: 'idle', | |
context: {}, | |
states: { | |
idle: { | |
on: { | |
FETCH: 'loading' | |
} | |
}, |
This file contains 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
const authMachine = Machine({ | |
id: 'auth', | |
initial: 'signin', | |
context: {}, | |
states: { | |
signin: { | |
on: { | |
SUBMIT: 'loading' | |
} | |
}, |
This file contains 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 |
This file contains 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 |