All right.
And once we can check for requests, once we display already our search form, we can also set up the
error.
There's going to be two use cases, Bordier, if the user doesn't exist or if we have used up all our
requests.
So those are the two things that we'll throw that are on in order to set that up.
We will have a state variable.
So we have our check rate requests loading and in between that function will add one more state variable
and that is going to be errors.
So we'll say error or errors, whatever.
So we're gonna go at cast error, then set error, set error.
And that is equal to a U.S.
State.
And in this case, the default value will be an object.
So in the object, we're going to have a property with the name of show and by default will set it equal
to a false.
And then as far as the message, we have M.S. G property.
And there will be an empty string.
So that's my default value.
Then I would want to set up a function.
So right after check rate.
And before I involve the use of fact, I would want to come up with my function for setting up the error.
And I'm gonna go with good old function.
I'm gonna go with doggle her.
And in this function, I'll pass on two things I'll pass in the show.
So whether to show or hide the error.
So, of course, even the show will be false.
Then, of course, we're not going to display the air.
And the second thing is the message.
So what we would want to display on the screen now once I pass in these two parameters.
Now, of course, I would want to invoke set error.
And in here I am passing in the object.
So since as far as the values, what is the state value?
I'm looking for the object.
Now I'm doing the same thing.
Or course I'm going to use my parameters somewhere.
So here show is equal to air show parameters and I'm passing in the argument.
And then, of course, the message.
So now once I have this toggle error, what I would want is to invoke it.
If there are no more questions.
So what I could say here is toggle error.
And since I would want to display the error, of course I'm going to say true.
And nine will pass in.
Sorry.
And then you have exceeded your hourly rate limit, Mark.
So maybe let's add a exclamation point as well.
Let's say that.
And now, of course, I would want to pass my error to a search.
What do we need to do when we just add in the value?
And we're going to say error.
So now we're passing this down.
And then in the error, of course, we will need to destruction as well.
So we're getting our object.
And I'm just saying here are at this point, I don't need the requests.
So I'm not going to be console logging anything anymore.
And we'll save it.
And if you'll notice, there's also another style component.
So we have one for the wrapper.
Yeah, I want to still there.
But then we also have one for here.
What does that look like?
Well, keep on scrolling and here you'll see the arrow wrapper.
So this is the one that I would want you to use it on up line where we have not the wrapper shourie
inside of the wrapper.
We will go we our heroine.
So we're going to go with air here.
We only want to display that error if the show properties.
True.
Correct.
Because that's what happened.
So we have error.
We have show by default.
It's false.
And then in here, of course, I'm setting it equal to true.
So now I would want to show there.
So let's do it in the search.
I'm going to say, if the error property is true, only then I would want to display my error wrapper.
So we're going to go with error and.
And a wrapper that is, of course, my setup.
And then inside of that error wrapper.
Now, I would want to go with a error message.
So I'm going to go here with a paragraph.
And then we're going to go with error and then am as G not serried.
Now it's going to be hard to see because we don't have the number.
And there's a little bit of specific, Seya says in Navar.
So what do we need to do quickly is to navigate to our dashboard more here than comment out of the nav
bar.
And then in NAV Bar, let's set up our wrapper.
So we're gonna have a number component.
And let's just add this wrapper start component, because, again, there's a little bit of specifics
here.
Assess where it just gets me a little bit more space.
Now, what's interesting right now, of course, I would want to see whether I can see the error correct.
And in order to see that our we simply need to head back to a context and notice here how I'm getting
remaining.
And I'm using the left keyword here just for testing purposes.
Now, I'm going to say remaining is equal to zero because it wouldn't make sense if I would just pass
your set request to zero.
That's not what is going to trigger detox, Lara, because in here I'm just passing in the zero.
What I would want to do instead is set the remaining true.
So then this will invoke this condition.
So let's say it.
And we should have two things.
Now, of course, we're not displaying the button anymore because remaining is zero.
So we have no more quest.
And we're also displaying there.
So what you're saying is, sorry, you have exceeded all your hourly rate limits.
So that's what's going to happen once we eventually get that error.
Now, one last thing that I want to do for a toggle error.
I just want to set up some default powers.
So that way, for example, if I would want to set it back to default, I can just simply say toggle
error and I'm just going to invoke it without passing any parameters.
So by default, if I don't pass in the value for the show, I'll send it back to false meaning that
I'll always hide the message.
And then the second thing, as far as the message itself.
It's always going to be a empty string.
And you'll see why I will use that, because we would need some kind of set back the default functionality
once we are performing a get request.
Now, in this case, though, of course, we're not going to keep it as a zero.
This is just the shockers.
What happens if we eventually have them a zero?
And I'm just going to set it back to my requests, which at the moment are 44.
And of course, that's why I still display the button.