nss-evening-cohort-11 / nutshell-ewoks-droids

Star Destroyer
0 stars 2 forks source link

Create Authentication Function #14

Closed Nikababy01 closed 4 years ago

Nikababy01 commented 4 years ago

USER STORY

As a user, I should be able to signin and view boards.

AC

WHEN the page loads I should see all boards THEN click Google Login AND receive authentication

WIREFRAMES

DEV NOTES


1. create authData.js helpers data file
2. add firebase imports:
    import firebase from 'firebase/app;
    import 'firebase/auth';
    import all the board components needed to display the view(may come later)
3. create a function to check the login state of the user:
      const  authDiv = $('#auth');
      const logoutButton = $('#navbar-logout-button');

      const checkLoginStatus =() => {
      firebase.auth().onAuthStateChanged((user) => {
           if (user) {
          // person is logged in
           authDiv.addClass('hide');
           logoutButton.removeClass('hide')
         } else {
            //person is Not logged in
           authDiv.removeClass('hide');
           logoutButton.addClass('hide');
         }
       });
      };

 export default { checkLoginStatus } ;

Note: This function will be continuously modified as needed to support events.

RELATED TICKETS

EX. #2