@@ -13,7 +13,7 @@ define(function (require, exports, module) {
1313 let isPopupVisible = false ;
1414
1515 // if user is logged in we show the profile menu, otherwise we show the login menu
16- const isLoggedIn = false ;
16+ let isLoggedIn = false ;
1717
1818 const defaultLoginData = {
1919 welcomeTitle : "Welcome to Phoenix Code" ,
@@ -37,10 +37,16 @@ define(function (require, exports, module) {
3737
3838 function _handleSignInBtnClick ( ) {
3939 console . log ( "User clicked sign in button" ) ;
40+ closePopup ( ) ; // need to close the current popup to show the new one
41+ isLoggedIn = true ;
42+ showProfilePopup ( ) ;
4043 }
4144
4245 function _handleSignOutBtnClick ( ) {
4346 console . log ( "User clicked sign out" ) ;
47+ closePopup ( ) ;
48+ isLoggedIn = false ;
49+ showLoginPopup ( ) ;
4450 }
4551
4652 function _handleContactSupportBtnClick ( ) {
@@ -129,7 +135,6 @@ define(function (require, exports, module) {
129135 // event handlers for buttons
130136 $popup . find ( "#phoenix-signin-btn" ) . on ( "click" , function ( ) {
131137 _handleSignInBtnClick ( ) ;
132- closePopup ( ) ;
133138 } ) ;
134139
135140 $popup . find ( "#phoenix-support-btn" ) . on ( "click" , function ( ) {
@@ -187,7 +192,6 @@ define(function (require, exports, module) {
187192
188193 $popup . find ( "#phoenix-signout-btn" ) . on ( "click" , function ( ) {
189194 _handleSignOutBtnClick ( ) ;
190- closePopup ( ) ;
191195 } ) ;
192196
193197 // handle window resize to reposition popup
0 commit comments