Global variable in backend module?

I have a simple function and want to store a global variable so that it can be reused in other functions. Not sure what’s wrong but im unable to modify the variable. Can someone help?

var user = {};
export function login(email, password) {
return Parse.User.logIn(email, password).then(function(u) {
user = u;
return ‘success’
}). catch(function (error){
return "error: " + error.code + " " + error.message
});