Setting Up Fetch Support Requests with Redux Thunk and Axios
Guide Tasks
  • Read Tutorial
  • Watch Guide Video
Video locked
This video is viewable to users with a Bottega Bootcamp license

[00:00:00] Hi welcome back to the reactor cores. In the last guy we set up our complete with redux and this guy we are going to be developing the action and utilizing redux to perform together a quest to retrieve our items. So our back end for the request we have three items. Three we have three rounds. OK. Now these three routes consist of I could probably just OK so I pulled up the server here and this is not code you'll be writing this is just our server here. So we have support requests and we have support requests and support us so we'll be dealing with support requests to retrieve our items and by the time you're using this this will be these will be authenticated routes so if for any reason you call that it's not authenticated routes one get on you too. I'm going to change that. Don't be turben so we have support requests that will retrieve all her support requests from mongo. We have support requests which will honesty's for us and he has a quest which will allow us to add some extremely similar to our newsletter routes which we've already done so we should be able to do this pretty quickly. So first we want to deal with just support us we can get all the items so we know minimizes and go post man and I'm going to change this to a get request and then I'm going to say support slots for quests and just that can be said and it's going to retrieve our items. So by the time you read this there's going to be a lot items here. [00:01:42][102.1]
[00:01:44] There's only two for me because I just develop these rocks. So basically we have two these leaky bathroom faucet and then created another one and just set it working. Because I was testing editing. We have a unit number on these and yet we have all these unique fields. So basically we just implement redux on an action in New York Sun to get us. So let's look back on let's go back into our index of J.S. in our actions folder and look at what we did for the archive. So we have Fox News Archive and we're passing you're talking to him receiving back a article. And are saying callback callback but that's not reading munition so let's just copy this and then scroll down to the bottom and the Zacky newsletter archive and annulments changes to fetch support requests. This is going to get our support of us no news letter you are. Are they. Are out. And instead of news that our time was changed us to support from quests and I would have made a dash with news letter archive but a totally space that and I recorded that before so I'm leaving it with B without the dash that you should put it dash when you build out and points you don't know what was put in dash when you built this. Because this is what it is back and you don't want to modify. You won't get anything back if you do this. You want me to use Camberley just in this instance but whenever you're developing your own Makin's we should use dashes instead of capital letters. So for us this will get our earning items back. Just great. [00:03:29][105.0]
[00:03:30] And now we need to change this. We don't want to be newsletter. We want to see fach support requests and now we want to create this action in our type stodginess. But first let's just import it so fetch West support quests and then let's go read this in our types of. So export constant support quests fetch support requests. Okay now the action and go back or fetch or hours of requests to our action time. And then we have our action here which is that support requests and then it's going to retrieve our data and then send it to our users where it's going to say pillowed is respons idea okay so we need to check current users. Now that's going to support a question users say okay. Case and then fed support and make sure you're important and appear at the top too. So case veterans support requests and then we want to do something very similar to what we did in the news letter. So let's go to the news release since you. We're saying OK we're cutting off the latest down and then we are getting our archive shifting so we can cut off the lead designer number. So we don't want to cut anything off because we're not displaying it in that way. So let's just ride it out fresh because this is a little too much more involved than what we want. So here let's add something to our initial statement to say OK we want support requests. We wanted this to be a blank collection on initialisation. OK. [00:05:19][109.5]
[00:05:20] Now here we want to say OK let's get our support from our action hero because we've fetched it from the server. So it's a constant support requests. It's evil in action. And then now what we can do is simply return the state and state support requests. And if we go to war if we are what we need to do is actually flesh this and show it in our our application state and have it in there. So we need to go to our let's go to our embassy or support request. Yes. And let's make the section that component did. So right as we support requests defense. So this process does fetch quests. That's what we call that support Quest's. That will fetch it and it will be in our our store which means we have access to it right here and it will be part of our state. So now you know I'm not props propolis just logging on make sure we are actually sort of relaxed tools the landscape. We don't need to simply open this up either in our browser or here and reloader your is working which is something is broken. What's happening to us is this request is not a function so let's go to our index and see why support requests because we need to pass a callback. But let's get to that. Well we should get rid of the callback anyway. Yeah. And let's go to our support request. Yes. And what say we think it was because we didn't see it I just see it. Well no because that would still bizarre actions and that's why internet props. OK let's go back to the browser. [00:07:19][119.0]
[00:07:20] We love the page and see getting our actions is not defined in support requests. J.S. on 139 actions we needed him for our actions in court starres actions from dot dot slash actions. OK let's go to the browser or trial. See it's working and it's working great for achieving it. No it's not working. It's for and it's probably because he's new again. Let's go ahead and check it out in action. So our index of actions Caesars support requests. All right. The reasons are working because we're seeing requests for requests to postman. You can see for us. So the endpoints for quest we reloaded we're getting our data but we can't see the console but we can definitely see it afterwards. You don't get around to get your right quick. Rheostat tools and select one of these options you'll see it here. And then I'm in the target market. So we have our state. We have our newsletter. All that junk and it's empty because we haven't reached those points. We haven't gone to that during this applications lifetime of this instance of it. Yeah let's we have our support requests which contains our support requests and which box we have selected so children count to. And that's exactly what we see in here. Really awesome stuff. It's working properly. Let's go ahead and commit our code. And then in the next guide we will display this content in a couple list items on the screen. OK. So let's say status get fatter get it and we get a lot of this guy. Let's say we set up the. What was it called. [00:09:14][114.2]
[00:09:15] We set up the facts support requests and action. Relax thank promised for Duzer. And yeah that's it. OK so let's go ahead and Koppen to the next guide where we will actually do something with this data. See the. [00:09:15][0.0]
[549.8]