1 00:00:01,130 --> 00:00:05,120 There's something on a mentioned very quickly about our ad blog post function now inside of here. 2 00:00:05,120 --> 00:00:08,830 We previously had a dispatch of type ad blog post. 3 00:00:08,840 --> 00:00:13,130 We actually technically don't need this dispatch type anymore because remember anytime that we add a 4 00:00:13,130 --> 00:00:18,680 blog post we're gonna color and point and then go back to our main index screen and an index screen 5 00:00:18,710 --> 00:00:23,280 is going to automatically go ahead and refresh our list of different blog posts. 6 00:00:23,360 --> 00:00:25,640 So we really don't need this dispatch anymore. 7 00:00:25,640 --> 00:00:27,260 We can remove it if we want to. 8 00:00:27,440 --> 00:00:32,480 And as a matter of fact we can even remove the corresponding case up inside of our reducer. 9 00:00:32,600 --> 00:00:39,900 So up here I could find case add blog post and we can completely remove it OK. 10 00:00:40,050 --> 00:00:46,280 So now we can move on to our next action function which is delete blog post so inside of here. 11 00:00:46,300 --> 00:00:47,050 Once again. 12 00:00:47,050 --> 00:00:52,530 Well we probably want to make a request to our Jason server endpoint in order to delete a blog post. 13 00:00:52,570 --> 00:00:57,610 We have to make a delete type request to bolt blog posts slash and the idea of the post we're trying 14 00:00:57,610 --> 00:01:00,570 to delete inside of delete blog posts. 15 00:01:00,660 --> 00:01:02,040 Well we've already got that idea. 16 00:01:02,100 --> 00:01:03,470 That's definitely good. 17 00:01:03,480 --> 00:01:10,720 So inside of your I'm going to comment out that dispatch and then we can put the a wait or see me async 18 00:01:10,750 --> 00:01:19,690 keyword in front of our function and inside of here we'll do a wait Jason server dot delete flash blog 19 00:01:20,230 --> 00:01:25,480 posts and then we have to do or use a little bit of string templating to get our ideas inside they're 20 00:01:25,730 --> 00:01:33,040 going to use back ticks as opposed to single quotes and we can inject ideas like so and we are once 21 00:01:33,040 --> 00:01:39,630 again in kind of interesting scenario after we delete the blog post we somehow need to refresh our list. 22 00:01:39,850 --> 00:01:45,100 Or alternatively we could continue to just dispatch an action and update our list of blog posts on the 23 00:01:45,100 --> 00:01:47,580 client side in this case. 24 00:01:47,590 --> 00:01:51,820 I think that it would be somewhat reasonable to just dispatch that action to delete our blog post although 25 00:01:51,820 --> 00:01:57,250 like I said we definitely could just refresh the entire list like we did with these two lines of code 26 00:01:57,250 --> 00:01:58,010 right here. 27 00:01:58,970 --> 00:02:00,680 So let's try this out first. 28 00:02:00,710 --> 00:02:07,290 I'll save this we'll flip back over I'll try to delete this blog post so when I delete it that's going 29 00:02:07,290 --> 00:02:11,840 to make our request as soon as we get back a success response from our endpoint. 30 00:02:11,850 --> 00:02:17,220 Then we'll go ahead and dispatch that action which is going to remove our post from local state. 31 00:02:17,220 --> 00:02:22,560 Again if we wanted to we could instead just make our overall request and refresh the entire list but 32 00:02:22,680 --> 00:02:25,290 again not strictly necessary. 33 00:02:25,440 --> 00:02:27,500 So let's delete pretty darn easy. 34 00:02:27,610 --> 00:02:31,380 Now we only have one left which is to edit an existing post. 35 00:02:31,390 --> 00:02:32,830 Let's take care of that in the next video.