From the course: Building Vue and Node Apps with Authentication

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Displaying authentication status

Displaying authentication status

From the course: Building Vue and Node Apps with Authentication

Start my 1-month free trial

Displaying authentication status

- [Instructor] In this video, we'll hide the register and log in buttons if the user is already authenticated and we will show them if they are not. So let's go to our front end project. Let's open up the app component and here we'll need to hide or show these two buttons between line seven and eight. So let's begin with the register button we'll use a v if directive, and we'll need to set it to true if they are not authenticated and false if they are. So for now I'll just hard code it to false and we can see that it's hidden. So let's create a new data property on line 29 we'll call it is authenticated. And we'll set that to true then let's copy that, and set it in place of our hard coded false. Now we can see it's showing again. And we'll set this to true if our local storage has the token, otherwise we'll set it to false. So we'll use a double exclamation mark to get a bouillon if there is a token inside local storage. Otherwise, we'll set it to false. Let's save that. And…

Contents