1 00:00:00,230 --> 00:00:00,590 All right. 2 00:00:00,690 --> 00:00:07,920 And once we can check for requests, once we display already our search form, we can also set up the 3 00:00:07,920 --> 00:00:08,290 error. 4 00:00:09,190 --> 00:00:16,030 There's going to be two use cases, Bordier, if the user doesn't exist or if we have used up all our 5 00:00:16,030 --> 00:00:16,500 requests. 6 00:00:16,890 --> 00:00:21,990 So those are the two things that we'll throw that are on in order to set that up. 7 00:00:22,020 --> 00:00:24,540 We will have a state variable. 8 00:00:24,840 --> 00:00:31,560 So we have our check rate requests loading and in between that function will add one more state variable 9 00:00:31,980 --> 00:00:33,530 and that is going to be errors. 10 00:00:33,630 --> 00:00:35,980 So we'll say error or errors, whatever. 11 00:00:36,390 --> 00:00:42,150 So we're gonna go at cast error, then set error, set error. 12 00:00:42,550 --> 00:00:44,670 And that is equal to a U.S. 13 00:00:45,000 --> 00:00:45,420 State. 14 00:00:45,720 --> 00:00:48,570 And in this case, the default value will be an object. 15 00:00:49,170 --> 00:00:55,350 So in the object, we're going to have a property with the name of show and by default will set it equal 16 00:00:55,350 --> 00:00:55,980 to a false. 17 00:00:56,370 --> 00:01:00,450 And then as far as the message, we have M.S. G property. 18 00:01:00,840 --> 00:01:02,220 And there will be an empty string. 19 00:01:02,640 --> 00:01:03,780 So that's my default value. 20 00:01:04,230 --> 00:01:07,350 Then I would want to set up a function. 21 00:01:07,820 --> 00:01:09,210 So right after check rate. 22 00:01:09,600 --> 00:01:17,200 And before I involve the use of fact, I would want to come up with my function for setting up the error. 23 00:01:17,700 --> 00:01:19,380 And I'm gonna go with good old function. 24 00:01:19,860 --> 00:01:22,260 I'm gonna go with doggle her. 25 00:01:23,430 --> 00:01:27,570 And in this function, I'll pass on two things I'll pass in the show. 26 00:01:27,930 --> 00:01:32,250 So whether to show or hide the error. 27 00:01:32,500 --> 00:01:35,280 So, of course, even the show will be false. 28 00:01:35,640 --> 00:01:38,030 Then, of course, we're not going to display the air. 29 00:01:38,520 --> 00:01:40,080 And the second thing is the message. 30 00:01:40,270 --> 00:01:46,350 So what we would want to display on the screen now once I pass in these two parameters. 31 00:01:46,740 --> 00:01:49,950 Now, of course, I would want to invoke set error. 32 00:01:50,390 --> 00:01:52,920 And in here I am passing in the object. 33 00:01:53,430 --> 00:01:56,760 So since as far as the values, what is the state value? 34 00:01:57,090 --> 00:01:58,170 I'm looking for the object. 35 00:01:58,500 --> 00:01:59,580 Now I'm doing the same thing. 36 00:01:59,710 --> 00:02:03,230 Or course I'm going to use my parameters somewhere. 37 00:02:03,250 --> 00:02:08,250 So here show is equal to air show parameters and I'm passing in the argument. 38 00:02:08,670 --> 00:02:10,350 And then, of course, the message. 39 00:02:10,770 --> 00:02:17,250 So now once I have this toggle error, what I would want is to invoke it. 40 00:02:17,790 --> 00:02:19,420 If there are no more questions. 41 00:02:19,890 --> 00:02:22,710 So what I could say here is toggle error. 42 00:02:23,250 --> 00:02:26,980 And since I would want to display the error, of course I'm going to say true. 43 00:02:27,400 --> 00:02:28,680 And nine will pass in. 44 00:02:28,880 --> 00:02:29,560 Sorry. 45 00:02:30,180 --> 00:02:38,280 And then you have exceeded your hourly rate limit, Mark. 46 00:02:38,280 --> 00:02:41,490 So maybe let's add a exclamation point as well. 47 00:02:42,060 --> 00:02:42,690 Let's say that. 48 00:02:43,220 --> 00:02:48,030 And now, of course, I would want to pass my error to a search. 49 00:02:48,480 --> 00:02:51,210 What do we need to do when we just add in the value? 50 00:02:52,110 --> 00:02:53,640 And we're going to say error. 51 00:02:53,730 --> 00:02:55,200 So now we're passing this down. 52 00:02:55,710 --> 00:02:59,430 And then in the error, of course, we will need to destruction as well. 53 00:02:59,550 --> 00:03:01,080 So we're getting our object. 54 00:03:01,110 --> 00:03:06,060 And I'm just saying here are at this point, I don't need the requests. 55 00:03:06,240 --> 00:03:09,220 So I'm not going to be console logging anything anymore. 56 00:03:09,660 --> 00:03:10,950 And we'll save it. 57 00:03:11,580 --> 00:03:16,560 And if you'll notice, there's also another style component. 58 00:03:16,950 --> 00:03:18,900 So we have one for the wrapper. 59 00:03:19,330 --> 00:03:20,490 Yeah, I want to still there. 60 00:03:20,880 --> 00:03:23,770 But then we also have one for here. 61 00:03:24,290 --> 00:03:25,050 What does that look like? 62 00:03:25,080 --> 00:03:29,250 Well, keep on scrolling and here you'll see the arrow wrapper. 63 00:03:29,820 --> 00:03:36,690 So this is the one that I would want you to use it on up line where we have not the wrapper shourie 64 00:03:37,080 --> 00:03:38,580 inside of the wrapper. 65 00:03:39,110 --> 00:03:41,420 We will go we our heroine. 66 00:03:42,090 --> 00:03:44,300 So we're going to go with air here. 67 00:03:44,430 --> 00:03:48,220 We only want to display that error if the show properties. 68 00:03:48,270 --> 00:03:48,630 True. 69 00:03:49,060 --> 00:03:49,470 Correct. 70 00:03:50,220 --> 00:03:51,420 Because that's what happened. 71 00:03:51,750 --> 00:03:52,560 So we have error. 72 00:03:52,980 --> 00:03:54,390 We have show by default. 73 00:03:54,390 --> 00:03:54,870 It's false. 74 00:03:55,320 --> 00:03:58,080 And then in here, of course, I'm setting it equal to true. 75 00:03:58,230 --> 00:03:59,980 So now I would want to show there. 76 00:04:00,510 --> 00:04:02,340 So let's do it in the search. 77 00:04:02,730 --> 00:04:10,350 I'm going to say, if the error property is true, only then I would want to display my error wrapper. 78 00:04:11,050 --> 00:04:13,580 So we're going to go with error and. 79 00:04:13,900 --> 00:04:17,340 And a wrapper that is, of course, my setup. 80 00:04:17,850 --> 00:04:20,250 And then inside of that error wrapper. 81 00:04:20,640 --> 00:04:24,420 Now, I would want to go with a error message. 82 00:04:24,690 --> 00:04:26,550 So I'm going to go here with a paragraph. 83 00:04:27,850 --> 00:04:34,040 And then we're going to go with error and then am as G not serried. 84 00:04:34,630 --> 00:04:37,570 Now it's going to be hard to see because we don't have the number. 85 00:04:37,810 --> 00:04:41,280 And there's a little bit of specific, Seya says in Navar. 86 00:04:41,650 --> 00:04:52,300 So what do we need to do quickly is to navigate to our dashboard more here than comment out of the nav 87 00:04:52,300 --> 00:04:52,630 bar. 88 00:04:53,320 --> 00:04:56,010 And then in NAV Bar, let's set up our wrapper. 89 00:04:56,470 --> 00:04:58,450 So we're gonna have a number component. 90 00:04:58,840 --> 00:05:03,420 And let's just add this wrapper start component, because, again, there's a little bit of specifics 91 00:05:03,420 --> 00:05:03,540 here. 92 00:05:03,550 --> 00:05:06,790 Assess where it just gets me a little bit more space. 93 00:05:07,330 --> 00:05:13,600 Now, what's interesting right now, of course, I would want to see whether I can see the error correct. 94 00:05:13,960 --> 00:05:21,040 And in order to see that our we simply need to head back to a context and notice here how I'm getting 95 00:05:21,130 --> 00:05:21,910 remaining. 96 00:05:22,350 --> 00:05:26,200 And I'm using the left keyword here just for testing purposes. 97 00:05:26,560 --> 00:05:33,550 Now, I'm going to say remaining is equal to zero because it wouldn't make sense if I would just pass 98 00:05:33,550 --> 00:05:36,030 your set request to zero. 99 00:05:36,640 --> 00:05:43,780 That's not what is going to trigger detox, Lara, because in here I'm just passing in the zero. 100 00:05:44,110 --> 00:05:47,490 What I would want to do instead is set the remaining true. 101 00:05:47,740 --> 00:05:51,730 So then this will invoke this condition. 102 00:05:52,120 --> 00:05:52,870 So let's say it. 103 00:05:53,460 --> 00:05:55,000 And we should have two things. 104 00:05:55,490 --> 00:06:01,060 Now, of course, we're not displaying the button anymore because remaining is zero. 105 00:06:01,330 --> 00:06:02,430 So we have no more quest. 106 00:06:03,010 --> 00:06:05,530 And we're also displaying there. 107 00:06:05,770 --> 00:06:10,420 So what you're saying is, sorry, you have exceeded all your hourly rate limits. 108 00:06:10,690 --> 00:06:15,520 So that's what's going to happen once we eventually get that error. 109 00:06:15,970 --> 00:06:19,140 Now, one last thing that I want to do for a toggle error. 110 00:06:19,630 --> 00:06:21,310 I just want to set up some default powers. 111 00:06:21,760 --> 00:06:27,550 So that way, for example, if I would want to set it back to default, I can just simply say toggle 112 00:06:27,550 --> 00:06:32,050 error and I'm just going to invoke it without passing any parameters. 113 00:06:32,380 --> 00:06:39,640 So by default, if I don't pass in the value for the show, I'll send it back to false meaning that 114 00:06:39,700 --> 00:06:41,650 I'll always hide the message. 115 00:06:42,130 --> 00:06:44,920 And then the second thing, as far as the message itself. 116 00:06:45,280 --> 00:06:47,800 It's always going to be a empty string. 117 00:06:48,370 --> 00:06:54,100 And you'll see why I will use that, because we would need some kind of set back the default functionality 118 00:06:54,490 --> 00:06:57,970 once we are performing a get request. 119 00:06:58,510 --> 00:07:01,630 Now, in this case, though, of course, we're not going to keep it as a zero. 120 00:07:01,930 --> 00:07:02,890 This is just the shockers. 121 00:07:02,950 --> 00:07:05,590 What happens if we eventually have them a zero? 122 00:07:06,100 --> 00:07:10,260 And I'm just going to set it back to my requests, which at the moment are 44. 123 00:07:10,730 --> 00:07:13,690 And of course, that's why I still display the button.