July 2018
Intermediate to advanced
420 pages
8h 46m
English
Now, we will create just one more function. This function will help us to identify if the user is logged in.
Add the following code right after the getUser() function:
isAuthenticated(): boolean { // get the token const token: string = this.getToken(); if (token) { return true; } return false; }
Now, we can use this information anywhere we want just by using the AuthService.currentUser and AuthService.isAuthenticated methods.
Read now
Unlock full access