On log in button changes to log out.

I have/found this code that works great for a custom login. I would like to add that when the user is logged in, the button text changes to log out, and they are logged out. Any ideas?

import wixUsers from ‘wix-users’ ;
import wixLocation from ‘wix-location’ ;
import wixWindow from ‘wix-window’ ;
$w . onReady ( function () {
$w ( “#forgotPassword” ). onClick ( ( event ) => {
//wixWindow.lightbox.close()
wixUsers . promptForgotPassword ()
. then ( ( ) => {
//
} )
. catch ( ( err ) => {
let errorMsg = err ; //“The user closed the forgot password dialog”
});
});
});
export function logInButton_click ( event ) {
let email = $w ( “#email” ). value ;
let password = $w ( “#password” ). value ;
if ( wixUsers . currentUser . loggedIn ) {

wixUsers . login ( email , password )
. then ( () => {
console . log ( “User is logged in” );
wixWindow . lightbox . close ();
wixLocation . to ( “/dashboard” );

} )
. catch ( ( err ) => {
console . log ( err );
$w ( “#errorMessage” ). expand ();
} );
}

}