There's something on a mentioned very quickly about our ad blog post function now inside of here.
We previously had a dispatch of type ad blog post.
We actually technically don't need this dispatch type anymore because remember anytime that we add a
blog post we're gonna color and point and then go back to our main index screen and an index screen
is going to automatically go ahead and refresh our list of different blog posts.
So we really don't need this dispatch anymore.
We can remove it if we want to.
And as a matter of fact we can even remove the corresponding case up inside of our reducer.
So up here I could find case add blog post and we can completely remove it OK.
So now we can move on to our next action function which is delete blog post so inside of here.
Once again.
Well we probably want to make a request to our Jason server endpoint in order to delete a blog post.
We have to make a delete type request to bolt blog posts slash and the idea of the post we're trying
to delete inside of delete blog posts.
Well we've already got that idea.
That's definitely good.
So inside of your I'm going to comment out that dispatch and then we can put the a wait or see me async
keyword in front of our function and inside of here we'll do a wait Jason server dot delete flash blog
posts and then we have to do or use a little bit of string templating to get our ideas inside they're
going to use back ticks as opposed to single quotes and we can inject ideas like so and we are once
again in kind of interesting scenario after we delete the blog post we somehow need to refresh our list.
Or alternatively we could continue to just dispatch an action and update our list of blog posts on the
client side in this case.
I think that it would be somewhat reasonable to just dispatch that action to delete our blog post although
like I said we definitely could just refresh the entire list like we did with these two lines of code
right here.
So let's try this out first.
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
to make our request as soon as we get back a success response from our endpoint.
Then we'll go ahead and dispatch that action which is going to remove our post from local state.
Again if we wanted to we could instead just make our overall request and refresh the entire list but
again not strictly necessary.
So let's delete pretty darn easy.
Now we only have one left which is to edit an existing post.
Let's take care of that in the next video.