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

Unlock the full course today

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

Delete listings with Auth

Delete listings with Auth

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

Start my 1-month free trial

Delete listings with Auth

- [Instructor] All right, we've done the, my listings page, the create listings page and the edit listings page. So the last step in this section is going to be the add user authentication to the delete listing flow. So here's what that's going to look like. Inside our listing service's delete listing method, what we're going to do is we're going to say, return new Observable, and this is going to be observable any, instead of observable listings since the delete listing end point doesn't actually return a listing. And we're going to say observer. And then this dot auth, dot user, dot subscribe, pretty much the same as what we've seen anywhere else. And then user and user dot get ID token dot then token. And we're going to copy and paste this request and say this, dot HTTP dot delete. And we're going to pass the HTTP options with auth header, and we're going to pass the HTTP options with auth token to this delete request…

Contents