Created
January 20, 2018 12:17
-
-
Save andrei-cacio/b6b8e5fc2752c29bbe0f497791f96edc 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.on(EVENTS.AUTH.SUCCESS, resolve); | |
eventEmitter.on(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