1 00:00:01,590 --> 00:00:05,130 In the last section we started putting together our post reducer. 2 00:00:05,190 --> 00:00:11,130 We decided the two pieces of application state one for the list of blog posts and one for the currently 3 00:00:11,130 --> 00:00:13,360 selected posts that were viewing. 4 00:00:13,420 --> 00:00:19,290 Again remember that we have a separate piece of state for each one in this section. 5 00:00:19,320 --> 00:00:22,400 We're going to finish wiring up the blog posts from douceur. 6 00:00:22,530 --> 00:00:25,430 We already have our fecche post type set up here. 7 00:00:25,490 --> 00:00:31,080 Important at the top and we've already set the key statement right here as well. 8 00:00:31,290 --> 00:00:38,840 We have to make sure that our in the case so we have a fetch posts action flowing through here. 9 00:00:39,020 --> 00:00:41,940 All we need to do is return our application state. 10 00:00:41,940 --> 00:00:44,970 That includes the list of blog posts from that action. 11 00:00:44,990 --> 00:00:51,270 Now before we write that line of code two reminders ferse with redox promise and actually shows the 12 00:00:51,270 --> 00:00:55,880 data that we care about is going to be available on action. 13 00:00:55,890 --> 00:01:03,780 Payload data and second are douceur needs to return a new object whenever we return our state. 14 00:01:03,870 --> 00:01:07,950 So with those two reminders in our head let's go ahead and get the shot. 15 00:01:08,370 --> 00:01:10,950 We'll say return and then we'll make a new object. 16 00:01:10,960 --> 00:01:16,590 You are going to say this is a distinctly new version of our state and will say just go ahead and take 17 00:01:16,590 --> 00:01:24,690 whatever our current state is and also add on all action payload data. 18 00:01:25,350 --> 00:01:31,560 So new objects take whatever our current state is and then add in this property. 19 00:01:31,800 --> 00:01:35,430 All of our blog posts as action payload data. 20 00:01:35,460 --> 00:01:38,280 So this is the response from the API right here. 21 00:01:38,960 --> 00:01:39,350 OK. 22 00:01:39,360 --> 00:01:40,980 So we've got our ACSM creator. 23 00:01:40,980 --> 00:01:42,040 We got our action. 24 00:01:42,090 --> 00:01:45,630 We've got our reducer all wired up. 25 00:01:45,630 --> 00:01:47,360 This is all starting to look pretty good. 26 00:01:47,360 --> 00:01:49,250 I think we're starting to come along here. 27 00:01:49,350 --> 00:01:54,990 I mean to save this and just to make sure that we don't have any blatant typos in here I'm going to 28 00:01:55,080 --> 00:02:01,140 save all my files and just go ahead and refresh in the browser and make sure I don't have any errors 29 00:02:01,140 --> 00:02:02,260 popping up here. 30 00:02:02,270 --> 00:02:06,730 Do you have any errors of mutants that you might have a typo somewhere in here. 31 00:02:06,810 --> 00:02:10,220 You know just go ahead and usual debug and process. 32 00:02:10,580 --> 00:02:10,850 OK. 33 00:02:10,860 --> 00:02:12,900 So we've got our data layer all wired up here. 34 00:02:12,900 --> 00:02:14,570 So what's next. 35 00:02:14,940 --> 00:02:20,580 We need to think about when to fetch our list of blog posts we need to make sure that the action creator 36 00:02:20,580 --> 00:02:24,470 is actually being called and that the network request is actually being made. 37 00:02:24,480 --> 00:02:27,200 And so the question is really when do we make that. 38 00:02:27,420 --> 00:02:31,260 Well obviously we want to do it whenever the user looks at the index page but where are we going to 39 00:02:31,260 --> 00:02:32,400 place that code. 40 00:02:32,730 --> 00:02:36,660 Let's go ahead and answer that question in the next section.