Last active
January 21, 2018 20:35
-
-
Save andrei-cacio/edcc796ba1e7eaf70ef86f9728c57001 to your computer and use it in GitHub Desktop.
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
import eventEmiter, { EVENTS } from './core/bus'; | |
function authenticate(user, password) { | |
return new Promise((resolve, reject) => { | |
eventEmitter.once(EVENTS.AUTH.SUCCESS, resolve); | |
eventEmitter.once(EVENTS.AUTH.FAILED, reject); | |
eventEmitter.trigger(EVENTS.AUTH.ATTEMPT, { user, pass }); | |
}); | |
} | |
export default authenticate; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment