Okay, we have our user interface ready and whatever we right clicked.
We don't do anything here.
So basically what we would like to do is first, what we can check is if we don't have the if highlight
is bigger than.
So what we can do is say if highlight is bigger than zero and highlight is lower than six.
So that means we will accept only from 1 to 5 records.
If it's outside of this range, then we will just ignore it.
So if you don't select any anything and you click create, we won't send the zero.
So you need to select one of the five stars to actually send something and how can we send it?
So basically we can copy something like we had here.
So copy and coming back here, I will paste it.
We'll use post method.
And what we have here is we have movies slash movie ID and that's fine.
And then we have rate movie URL and slash.
So this is fine.
We will have the URL like this and we need to pass an extra arguments here.
So we in this case we stringify the title and description.
That was when we update this movie.
But in our case, what we want to send is stars and then we can use our highlight variable that we have.
So this is what we need to pass.
The movie ID will be from here and also the token the user will be from the token.
So we don't need to pass anything else to that function.
Okay.
So what we have here is we won't get the in response the movie.
What we have is we will have response and let me put it in console and we'll see what's actually in
response.
So response here and then go here and then we'll select four and then rate it.
And if I will make it a little bit bigger, you can see this is the object coming from response.
This is I put it here in the console log and we have a few things here.
So what we could do is we can use some of of this to display.
But I'm interested here in the message.
So what we could actually do here is we could use an alert so we can use an alert from React Native
to display that on screen.
So I will import alert, alert like this.
And then what I can do is I can use alert.
That alert.
So one is capital and one is lowercase.
And then we will first.
Provide a title for for that alert so I can do rating and then we can have response.
And in response we have that message.
So what I can do is response message, put it in the alert.
So if we save it now and we can go here, you can pick something, rate it, and then you see rating,
that's the title rating updated.
That's what what is coming from the message and I can close it.
And then we have another option, what we can do.
So at this point, what we can also do is we can set highlight to zero whatever we already have this
one and then zero here.
And basically this here, this alert alert.
What we can have is we can basically reuse something like this in our error.
So if we'll have an error, what we can do is we can actually do error.
That's going to be our title.
And we print the error message here to the to our alert.
If something goes wrong, it will be displayed to the user, if you like.
If you don't want to show the user this error, then it's fine.
But that's another option.
How you can notify your user about things that something wrong happened.
Like uh, the, the server is not available or something like that.
Anyway, so we have, uh, this, what we could do is basically we could fetch a new data here or we
can direct back to the this list here.
It's really up to you.
What would you like to do at this point?
But you already know how to redirect to different URL, you know how to get the newest information.
So if you would like to update, you could have another one update movie and you can call it from here
and you will just get the this uh, new movie and then you will overwrite the movie we have here.
So basically it is very easy to do.
We know how to do, how to do it, but I'm not going to do it in this tutorial because we still have
a lot of other things to cover.