client/src/utils/requireAuth.js
/**
     * @description validates the authentication status of user
     *
     * @method componentWillMount
     *
     * @return {void} Null
     *
     */
@description validates the authentication status of user
@method componentWillMount

@return {void} Null
@description validates the authentication status of user @method componentWillMount @return { void } Null
componentWillMount() {
      const JWT_SECRET = process.env.JWT_SECRET || '!s_aka*@#0';
      const token = localStorage.getItem('token');
      if (!token) {
        this.props.signOut();
      } else if (token) {
        jsonwebtoken.verify(token, JWT_SECRET, (error, decoded) => {
          if (error || decoded.exp < (new Date().getTime() / 1000)) {
            this.props.signOut();
          }
        });
      }
    }
componentWillMount ( ) { const JWT_SECRET = process . env . JWT_SECRET || '!s_aka*@#0' ; const token = localStorage . getItem ( 'token' ) ; if ( ! token ) { this . props . signOut ( ) ; } else if ( token ) { jsonwebtoken . verify ( token , JWT_SECRET , ( error , decoded ) => { if ( error || decoded . exp < ( new Date ( ) . getTime ( ) / 1000 ) ) { this . props . signOut ( ) ; } } ) ; } }
@description validates the authentication status of user
 @method componentWillMount
@description validates the authentication status of user @method componentWillMount