function showMainMenu() { return user.login().then(function () { // ... Code to display main menu }); }