From the course: Angular: Creating and Hosting a Full-Stack Site

Unlock the full course today

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

Edit listings with Auth

Edit listings with Auth

From the course: Angular: Creating and Hosting a Full-Stack Site

Start my 1-month free trial

Edit listings with Auth

- [Instructor] Now that we've done the create listing flow, our next step is to incorporate user authentication into the edit listing flow. This will actually be incredibly similar to what we just saw. What we're going to do is head over to our front end. And scroll down to the editListing method. And inside there, we're going to say return new Observable Listing. And then we're going to say observer. And this is going to be a callback. And inside there, we're going to say this.auth.user.subscribe. And we're going to use that user object to get the user's ID token. So we're going to say user && user.getIdToken.then. And once we have the token, we're going to copy and paste the original request here into this callback. And we're going to change this to httpOptionsWithAuthToken. Token. And then we're going to say .subscribe and just call observer. Oops, and actually this should be observer up here. So we're going to say…

Contents