WEBVTT 00:01.650 --> 00:06.600 So we have a route and a handler on the back end that will return a list of all users as Jason. 00:06.750 --> 00:10.720 Now we need to update our front end to call that route and execute that handler. 00:11.250 --> 00:14.610 So I'm looking at all dash users, top page dog HTML. 00:15.000 --> 00:20.640 And the first thing I'll do down here in the JavaScript section is at an event listener, document and 00:20.850 --> 00:21.780 event listener. 00:21.810 --> 00:27.360 And it will be on the condition dom content loaded and I'll execute this function. 00:31.440 --> 00:39.810 And I will move this let body equals bit inside of that hamburger, and I know I'm also going to need 00:39.810 --> 00:42.780 to get the token so I can call the back in with my authorization. 00:43.500 --> 00:48.090 So let token equal local storage and get item. 00:48.660 --> 00:49.840 And I'm looking for token. 00:53.580 --> 00:59.660 Now I'm going to call fetch next and it'll be very similar to what we did here on the all sales page. 00:59.670 --> 01:06.240 So just to make things a little bit faster or copy this concert request options and all of this as well. 01:06.370 --> 01:08.810 OK, so I'll copy that. 01:10.020 --> 01:16.350 Go back to all users page and paste it in and we'll just modify it as necessary so we actually don't 01:16.350 --> 01:17.490 have a body for this one. 01:17.490 --> 01:20.370 So I can delete the body part from the request options. 01:20.740 --> 01:22.470 Everything else stays exactly the same. 01:22.590 --> 01:26.940 And I'm not calling all sales, I'm calling all users. 01:28.230 --> 01:33.090 And what I'll do first, just to make sure it works, is get rid of all of this if stuff. 01:33.090 --> 01:42.870 I'll just delete that entirely and just put in here, console the log data just to make sure it works. 01:43.450 --> 01:46.740 So let's save that and start our application. 01:47.370 --> 01:48.090 Make start. 01:52.600 --> 01:55.960 And I go back to my Web browser and I go to localhost 01:58.660 --> 02:00.970 four thousand, I will log in. 02:11.470 --> 02:16.300 Open my JavaScript console and try going to admin all users. 02:18.530 --> 02:24.620 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 02:24.620 --> 02:25.080 pretty well. 02:25.550 --> 02:29.750 So in the next lecture, we'll modify our JavaScript to write the table as necessary.