1 00:00:00,510 --> 00:00:03,570 We have two more big steps to take care of inside of our form. 2 00:00:03,570 --> 00:00:08,480 First off we need to make sure that we actually take the form values and post them off to our back end 3 00:00:08,490 --> 00:00:09,420 API. 4 00:00:09,550 --> 00:00:13,830 And we also have to make sure that after we do THAT POST request we also navigate our users back to 5 00:00:13,830 --> 00:00:16,640 the dashboard route or the dashboard component. 6 00:00:16,650 --> 00:00:22,080 Now before we tackle those two things there's one little issue I want to bring to your attention kind 7 00:00:22,080 --> 00:00:26,040 of around the naming conventions that we've used inside of our applications so far. 8 00:00:26,400 --> 00:00:30,680 So we've been putting together our front end form to create our survey. 9 00:00:30,840 --> 00:00:36,600 And we have already gone to our back end express API in a previous video like way previous and we put 10 00:00:36,600 --> 00:00:41,820 together the back end endpoint for accepting post requests to create a new survey. 11 00:00:41,820 --> 00:00:47,190 Now there's a little bit of kind of dissonance between these two features that we've put together thus 12 00:00:47,190 --> 00:00:47,840 far. 13 00:00:48,090 --> 00:00:49,380 Here's the thing. 14 00:00:49,380 --> 00:00:55,220 On the client side of our application Our form is currently producing an object so that form values 15 00:00:55,220 --> 00:01:00,390 saying that we've been passing all over the place and it has a property named emails. 16 00:01:00,630 --> 00:01:06,090 However on our backend when we previously put together together the API we had said that we expect to 17 00:01:06,090 --> 00:01:12,420 receive a object that are a request that has a body property of recipients. 18 00:01:12,420 --> 00:01:17,550 So we've got a real mismatch right now between the client side and what it's trying to post and the 19 00:01:17,550 --> 00:01:20,980 back end and what it actually expects. 20 00:01:21,000 --> 00:01:24,770 So we're going to do a little bit of kind of reconfiguration side this video. 21 00:01:24,780 --> 00:01:31,230 We're going to rename this email's property on our client side to the recipients instead. 22 00:01:31,250 --> 00:01:34,160 Now this is going to be a really easy a really straightforward factor. 23 00:01:34,170 --> 00:01:37,790 So let's just get to it right now inside my code editor. 24 00:01:37,980 --> 00:01:44,270 I'm going to find first the form fields file inside of our surveys directory and inside of there I'll 25 00:01:44,310 --> 00:01:50,850 find the last property last object and rather than giving it a name of e-mails we'll change the name 26 00:01:50,850 --> 00:01:53,600 to be recipients instead. 27 00:01:53,610 --> 00:01:59,700 So now we're saying hey there's going to be a property in our form called recipients as always do double 28 00:01:59,700 --> 00:02:02,310 check your spelling on recipients right here. 29 00:02:02,310 --> 00:02:08,430 Now the only other place we have to change this is inside of our survey form component inside of survey 30 00:02:08,430 --> 00:02:15,120 form down at the bottom the file we can find our validate function and validate is currently assuming 31 00:02:15,120 --> 00:02:16,880 that we have an email property. 32 00:02:16,890 --> 00:02:23,610 So rather than making use of emails we will instead say estopped recipients and it should be looking 33 00:02:23,610 --> 00:02:28,850 at the value on the values object of recipients over there as well. 34 00:02:29,370 --> 00:02:33,080 So as recipients and value recipients. 35 00:02:33,370 --> 00:02:33,700 OK. 36 00:02:33,720 --> 00:02:34,530 So that's pretty much it. 37 00:02:34,530 --> 00:02:39,180 That's the only renaming we have to do to make sure that our back and in our client are producing the 38 00:02:39,180 --> 00:02:43,060 same property names so that in mind let's take a quick break. 39 00:02:43,080 --> 00:02:48,060 We'll come back in the next section and we're then going to create our post request to actually send 40 00:02:48,360 --> 00:02:51,390 our e-mail or our form to our back end server. 41 00:02:51,480 --> 00:02:53,250 So I'll see you in just a minute.