WEBVTT

00:01.720 --> 00:07.930
Okay, we have our user interface ready and whatever we right clicked.

00:07.960 --> 00:10.160
We don't do anything here.

00:10.180 --> 00:19.360
So basically what we would like to do is first, what we can check is if we don't have the if highlight

00:19.360 --> 00:20.590
is bigger than.

00:20.590 --> 00:33.880
So what we can do is say if highlight is bigger than zero and highlight is lower than six.

00:34.300 --> 00:38.950
So that means we will accept only from 1 to 5 records.

00:38.950 --> 00:42.700
If it's outside of this range, then we will just ignore it.

00:42.700 --> 00:48.460
So if you don't select any anything and you click create, we won't send the zero.

00:48.490 --> 00:53.830
So you need to select one of the five stars to actually send something and how can we send it?

00:53.830 --> 00:58.630
So basically we can copy something like we had here.

01:00.670 --> 01:05.680
So copy and coming back here, I will paste it.

01:05.710 --> 01:08.320
We'll use post method.

01:08.320 --> 01:14.290
And what we have here is we have movies slash movie ID and that's fine.

01:14.290 --> 01:19.540
And then we have rate movie URL and slash.

01:19.540 --> 01:21.460
So this is fine.

01:21.460 --> 01:26.680
We will have the URL like this and we need to pass an extra arguments here.

01:26.680 --> 01:30.730
So we in this case we stringify the title and description.

01:30.730 --> 01:33.070
That was when we update this movie.

01:33.070 --> 01:43.510
But in our case, what we want to send is stars and then we can use our highlight variable that we have.

01:43.510 --> 01:45.220
So this is what we need to pass.

01:45.220 --> 01:51.040
The movie ID will be from here and also the token the user will be from the token.

01:51.040 --> 01:55.450
So we don't need to pass anything else to that function.

01:56.050 --> 01:56.470
Okay.

01:56.470 --> 02:01.700
So what we have here is we won't get the in response the movie.

02:01.730 --> 02:09.500
What we have is we will have response and let me put it in console and we'll see what's actually in

02:09.500 --> 02:10.400
response.

02:11.300 --> 02:20.630
So response here and then go here and then we'll select four and then rate it.

02:20.630 --> 02:27.380
And if I will make it a little bit bigger, you can see this is the object coming from response.

02:27.380 --> 02:32.750
This is I put it here in the console log and we have a few things here.

02:32.750 --> 02:38.690
So what we could do is we can use some of of this to display.

02:38.690 --> 02:41.060
But I'm interested here in the message.

02:41.060 --> 02:50.600
So what we could actually do here is we could use an alert so we can use an alert from React Native

02:50.630 --> 02:52.250
to display that on screen.

02:52.250 --> 02:57.800
So I will import alert, alert like this.

02:58.430 --> 03:03.260
And then what I can do is I can use alert.

03:03.290 --> 03:04.610
That alert.

03:04.610 --> 03:07.610
So one is capital and one is lowercase.

03:07.610 --> 03:10.070
And then we will first.

03:13.470 --> 03:21.240
Provide a title for for that alert so I can do rating and then we can have response.

03:21.240 --> 03:23.760
And in response we have that message.

03:23.760 --> 03:28.650
So what I can do is response message, put it in the alert.

03:28.650 --> 03:36.390
So if we save it now and we can go here, you can pick something, rate it, and then you see rating,

03:36.390 --> 03:38.760
that's the title rating updated.

03:38.790 --> 03:43.410
That's what what is coming from the message and I can close it.

03:43.410 --> 03:46.350
And then we have another option, what we can do.

03:46.350 --> 03:56.370
So at this point, what we can also do is we can set highlight to zero whatever we already have this

03:56.370 --> 04:00.210
one and then zero here.

04:00.240 --> 04:05.460
And basically this here, this alert alert.

04:05.490 --> 04:12.030
What we can have is we can basically reuse something like this in our error.

04:12.030 --> 04:17.200
So if we'll have an error, what we can do is we can actually do error.

04:17.230 --> 04:18.760
That's going to be our title.

04:18.760 --> 04:23.860
And we print the error message here to the to our alert.

04:23.860 --> 04:27.820
If something goes wrong, it will be displayed to the user, if you like.

04:27.850 --> 04:32.080
If you don't want to show the user this error, then it's fine.

04:32.080 --> 04:33.490
But that's another option.

04:33.490 --> 04:39.550
How you can notify your user about things that something wrong happened.

04:39.550 --> 04:42.700
Like uh, the, the server is not available or something like that.

04:43.180 --> 04:51.970
Anyway, so we have, uh, this, what we could do is basically we could fetch a new data here or we

04:51.970 --> 04:55.300
can direct back to the this list here.

04:55.300 --> 04:56.500
It's really up to you.

04:56.530 --> 04:58.810
What would you like to do at this point?

04:58.810 --> 05:05.200
But you already know how to redirect to different URL, you know how to get the newest information.

05:05.200 --> 05:12.010
So if you would like to update, you could have another one update movie and you can call it from here

05:12.010 --> 05:19.470
and you will just get the this uh, new movie and then you will overwrite the movie we have here.

05:19.470 --> 05:21.240
So basically it is very easy to do.

05:21.270 --> 05:27.810
We know how to do, how to do it, but I'm not going to do it in this tutorial because we still have

05:27.810 --> 05:29.730
a lot of other things to cover.
