Setting Up the Update Status Action and Route
Guide Tasks
  • Read Tutorial
  • Watch Guide Video
Video locked
This video is viewable to users with a Bottega Bootcamp license

[00:00:00] Hey welcome back to the reactor building in the sky. We're going to implement a feature where we can basically move these items. So the first one not sure of the design is allowing us to do this. But basically the idea is you have these items here and hasn't happened and you can say OK this is a pending item. We need to start working on it and then they move it to progress. So you click on it is in progress and then obviously the design it's not in here the functionality but the idea of the next the next idea when it's in progress is to quit that same button in the same area and move it to complete. And then if it's incomplete I would imagine. And if you have it this was like for a client and you had you obviously would have communication with them you'd want to ask them what they want to hear because clearly the design doesn't let us go to complete. And my initial thought would be to move from complete depending pending have that option. I mean that would make sense but the client might not have that same idea. You don't want to go ahead and implement features that you don't know the client wants you want to be specific in what they want if you want to risk wasting the time to do that you can do that but you might you might wait some time because you shouldn't charge them for a feature and it probably won't let you do more. [00:01:35][94.9]
[00:01:35] So basically our design doesn't really tell us what to do but since we're we don't have an actual client for this project we can pretty say we assume that we when we own computers. So basically just to recap the idea here is to have the button here on pending and it's not hovering for some reason but there's supposed to be a bottom here and then you click it as an item and see it in progress and then when it's in progress you can click it again and it moves it to complete its colloquia you can reopen it if you want and put it back in. So pretty simple functionality let's go ahead and get into it. So we're going to need a function that allows us to hidden coin. So let's just write out our action here and take stock as an action and must you say export function and what's called a safe new support request status because we're going to be changing the status and what we want to kind of take into this is a couple Kramar Sweeney 9D so we can actually like specify which one operating on server and then we need the new status of course. And then we're going to be using lunk because we want to get a endpoints we want a return function dispatch and then here we want to say we want to basically determine the size and posted to the server so let's say that let's show you how this works and postmaster's you understand the route we're hitting. So I'll show you the route online that we have in servers. So this is code that you're not going to write and you haven't written this this is purely the server side that I really know Jay has expressed Jaeson and Mongo. [00:03:21][106.0]
[00:03:22] So yeah basically the idea here is we have the support requests you're out and then we update status and then we're specifying Yandi. Okay. And then inhere were just saying okay let's get the new status from the body and then say let's find one from our database from Mungu and then once we find that it should be pretty instantaneous we will change the status to the new status which we're getting in the body or request okay that we're going to save it. Mongo schema item back to our collection and then once we've saved it we will send it back to the race to the user that since it's been saved. The new status. OK. So we hear that and I'm going to show you a post on how this works. We have it in here for request update status. No we need to provide an ID. So I'm going to open up a new cap here that will open a new tab. I'll just do it on this one. So I'm going to say I'm going to go take property management group slosh and then all that property requestor support us. So support requests to get all our requests here and then I'm going to say get in there and we're just going to be getting our items here. And again so I can get an ID so we can update one. So let's look at what we have. We have an item that says let's see the title of this new property request we can fix my stuff okay. This is day that you won't see it because you're going to be different. Like I said a lot. [00:05:03][101.0]
[00:05:04] But basically if I get my app I have that specific one and it said who is in progress right. So it's complete. So I go to my completed box we have new prop you can squeeze come fix my stuff. Now I'm going to change the status to let's say pending swoony the back of Independiente and no three items here using Hosemann. So when is the support request. I'm going to go back to the one we were doing. The site once those four requests update status. And then I see a passing the underground right here and then I'm going to throw it into this and wait here and you can test this all out. Even the post maybe you just you're going to be dealing with different objects because the data is no way going to be the same from the very first people taking this course. So let's go ahead and I'm going to hit send and it should be updated to status and we wanted to change it depending because it's already complete for some support items that are successfully saved. I'm going to spending a lot of pages already. And now we have this new property request. Now there are ways to make a state automatic reload that can be added but we're not going to do this in this op. We might do it in a drop drop but we're all going to be learning how to fetch it automatically if you've got any Ruby programming and we Jordan's stuff is action Kamall allows us to do this and Ruby but that's pretty off topic not even anything to do with reac but let's go ahead and get back in there. [00:06:49][105.1]
[00:06:50] So that's basically the idea of how you and saying I know we're just going to pass in a status of whatever we're doing and then we're going to put it in say a new Super Request status and perform Knoxfield post requests. So that's the general start of it. I want the guy here just so we can take a breather and so you can mess around and post if you want. And then after this guy and the next guy we will actually put in the post request here or the request rather is put and then we will create the button request item here that will actually allow us to call US actions. So let's go and commit our coding and get that status. Get out get it come in. I must just say complimented same news for request Stass action and I intend to learn about the status. OK that's good. Let's go ahead and hop into the actual implementation now. In the next day. [00:06:50][0.0]
[407.0]