Created
June 15, 2017 17:14
-
-
Save jonathan-fulton/63706c9490634bc48f768051256dbdf1 to your computer and use it in GitHub Desktop.
Example of a side effect
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
function getUserByEmailAndPassword(email, password) { | |
let user = UserService.getByEmailAndPassword(email, password); | |
if (user) { | |
LoginService.loginUser(user); // Log user in, add cookie (Side effect!!!!) | |
} | |
return user; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment