1 00:00:00,740 --> 00:00:04,680 In the last video we created our first New Stream we're going to go through the process of creating 2 00:00:04,710 --> 00:00:11,560 one more Stream right here so I can put in a quick title of stream and a description of here's some 3 00:00:11,730 --> 00:00:14,980 stream and I've got my network request Lague open again. 4 00:00:15,120 --> 00:00:18,270 I'm going to submit this and then check out the post requests that we had created. 5 00:00:19,590 --> 00:00:20,010 All right. 6 00:00:20,010 --> 00:00:24,000 So when I inspect this thing I'm going to open up the preview tab and you'll notice that we get back 7 00:00:24,000 --> 00:00:30,850 a response right here of the description the title and the newly assigned ID from the API server. 8 00:00:31,140 --> 00:00:36,150 So at this point we've basically got this new record that reflects stream that we've just created coming 9 00:00:36,150 --> 00:00:38,760 back and the response that we made over to that API. 10 00:00:39,090 --> 00:00:43,410 So when we start to think about that and think about our actual creator back you're inside the actions 11 00:00:43,450 --> 00:00:44,980 index file. 12 00:00:45,090 --> 00:00:49,410 I think that we need to somehow get a handle on the response that comes back from that post request 13 00:00:49,620 --> 00:00:54,740 because it contains the actual saved record of the stream that we just created. 14 00:00:55,750 --> 00:01:01,240 So inside a create stream I'm going to put the weight keyword on there will say cancer response equals 15 00:01:01,290 --> 00:01:03,530 a weight stream's up post. 16 00:01:03,530 --> 00:01:07,780 So now that we have a handle on the stream that just got created we're probably going to want to dispatch 17 00:01:07,810 --> 00:01:13,450 an action with a payload of that stream and then we can eventually create a reducer and pick up that 18 00:01:13,450 --> 00:01:17,760 stream that was created and save it inside there or whatever it is we want to do. 19 00:01:17,830 --> 00:01:21,610 So in order to dispatch an action we first need to have a type. 20 00:01:21,610 --> 00:01:25,050 Remember we now have this idea of these constant type value. 21 00:01:25,040 --> 00:01:27,190 So we define inside of our types file. 22 00:01:27,190 --> 00:01:32,290 So let's open up that type's file rate a new type inside there and then make sure we import it into 23 00:01:32,290 --> 00:01:35,660 this indexed file. 24 00:01:35,680 --> 00:01:36,710 So here is types. 25 00:01:36,880 --> 00:01:39,630 I'm going to create a new type of. 26 00:01:39,670 --> 00:01:47,740 How about create stream and then I'll give this a type of create stream for the actual string value. 27 00:01:48,970 --> 00:01:50,040 OK so that looks good. 28 00:01:50,090 --> 00:01:57,020 So now we'll save this a flip back or two that actions index as file and I will import create stream 29 00:01:57,110 --> 00:01:58,570 at the top. 30 00:01:58,600 --> 00:02:02,920 Now we have everything we need back down inside the Create stream action creator itself. 31 00:02:02,920 --> 00:02:12,150 After we get our response I'm going to dispatch an action with that type of create stream for the payload. 32 00:02:12,390 --> 00:02:18,060 I'm going to make sure that I take response data and return it with the data right here because remember 33 00:02:18,060 --> 00:02:23,490 when we get a response back from ASIO's the response object has a ton of information about the response 34 00:02:23,640 --> 00:02:27,030 but we only care about the information that was returned inside the request. 35 00:02:27,120 --> 00:02:31,050 So that's why we are only returning response to data inside that pallet property. 36 00:02:31,720 --> 00:02:32,980 OK so looks great. 37 00:02:32,990 --> 00:02:37,330 Now the only thing here is we don't have a producer so we can definitely go and create ever douceur 38 00:02:37,340 --> 00:02:42,980 that's going to essentially save the stream that we just created inside of our application level States. 39 00:02:43,010 --> 00:02:47,570 But before we do I want to take a quick pause and then mention something kind of interesting about all 40 00:02:47,570 --> 00:02:50,070 the action creators that you and I are going to end up creating. 41 00:02:50,240 --> 00:02:52,620 So quick pause you know I'll see you in just a minute.