So we have a route and a handler on the back end that will return a list of all users as Jason.
Now we need to update our front end to call that route and execute that handler.
So I'm looking at all dash users, top page dog HTML.
And the first thing I'll do down here in the JavaScript section is at an event listener, document and
event listener.
And it will be on the condition dom content loaded and I'll execute this function.
And I will move this let body equals bit inside of that hamburger, and I know I'm also going to need
to get the token so I can call the back in with my authorization.
So let token equal local storage and get item.
And I'm looking for token.
Now I'm going to call fetch next and it'll be very similar to what we did here on the all sales page.
So just to make things a little bit faster or copy this concert request options and all of this as well.
OK, so I'll copy that.
Go back to all users page and paste it in and we'll just modify it as necessary so we actually don't
have a body for this one.
So I can delete the body part from the request options.
Everything else stays exactly the same.
And I'm not calling all sales, I'm calling all users.
And what I'll do first, just to make sure it works, is get rid of all of this if stuff.
I'll just delete that entirely and just put in here, console the log data just to make sure it works.
So let's save that and start our application.
Make start.
And I go back to my Web browser and I go to localhost
four thousand, I will log in.
Open my JavaScript console and try going to admin all users.
And I've got an array back and it has one object in it, and it is our one user, so that seems to work
pretty well.
So in the next lecture, we'll modify our JavaScript to write the table as necessary.