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 characters
| const login = (context, event) => new Promise((resolve, reject)=>{ | |
| const { email, password } = event; | |
| if(email !== 'john.doe@gmail.com' || password !== 'azerty'){ | |
| return reject({ error: 'Le mot de passe ou l\'email est incorrect !' }) | |
| } | |
| return resolve({ email, password }); | |
| }); |
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 characters
| const promiseMachine = Machine({ | |
| id: 'promise', | |
| initial: 'pending', | |
| states: { | |
| pending: { | |
| on: { | |
| RESOLVE: 'resolved', | |
| REJECT: 'rejected' | |
| } | |
| }, |