Now will be creating and then my third intervention that is going to help us to submit our data.
And that function is going to be passed to Abdul GSX so that we can start our quiz.
So let's create the handle method.
So right beneath the fetch method will be creating concert.
Handles amid.
No, this is going to be a narrow function that is going to take an event as an argument.
Now since this is a method, we make sure that whenever this function is called browser and doesn't
relaunch itself, so it should prevent default.
All right, so we have saved it from the.
Apart from it, we'll make sure that we'll be creating a constant and this content is going to be called
as you are.
So basically, this is the URL we want to go to.
And this is going to be a template string because we'll be adding different variables to it.
So put the backpacks and based the statement that has been brought to you inside of your documents,
neither wondering what these amount difficulty as well as category.
So if you might recall that when we made a state question, we already provided it with our default
amount of Category four difficulty.
And as for the table will be creating what they will know to contest tables.
So basically, a table is a reference value that is going to define various number points for various
drinks and sports has the point of 19, whereas our history has point or twenty three and a politics.
What is the point of twenty four?
So we have made our table as very.
Now we need to this structure.
Amount, difficulty, as well as a.
Amount, difficulty and the category.
So let's restructure them from Quest, so right beneath or even or prevent default, create a contest
that is going to have the value amount as well as difficulty.
As well as that category, now, this all is initialized to quiz, so we are restructuring under drama
quiz.
So now we have fetched are you all?
Now we need to post a request to update you so that we can get our data.
So fetch questions and this is going to have your role as a parameter.
Now we need to make sure that fetch of questions also takes up a new order.
Now, apart from this, you will be giving it the other that we are getting from a subject matter.
So you are.
All right, so now we have successfully created a fetch method as well as a hand as a method.
Now they're going to create two a method one is going to be for opening our models as well as closing
our models.
So right beneath her.
I right above your handles and let's create a contest and there's going to be for opening our borders
or open.
More now, this again, is another function.
Now, if one clicks on open model, what we want to do that is that set model to true, that means said
the model value equals true.
That means our model is open, apart, apart.
It will be creating another method that is going to close our model.
So close model.
This, again, is another function.
And it will make sure that.
SEC Modi is stone to false.
That means flip a switch as a flip now and after setting it to and make sure that set waiting as a.
Is true.
And apart from celebrating set correct is that means you have refreshed state of the number of questions
that are correct.
So we have made these two methods.
Now we have handled some open method, close model method as well as our fetch method.
Now, apart from this, we'll be having two other methods.
And if we just go outside, we will be also having methods to set our index as well as set correct that
the number of questions that I correct in our answers.
Now, just beneath your clothes model, we making these two methods.
Now, researching another method that is the next question method, which is going to handle our data
of search index and opening our model.
So concert.
Next question.
So as the name suggests, the name is self-explanatory that it is going to be called on every next question
and this again is going to be out function.
And it is going to set our index right.
And this is going to dig up all index as a parameter.
So basically, it's taking our previous value.
And this is going to make sure that our index that's critical and index that is going to be equal to
all the next president of the increment, incriminating the order value by one.
So now if?
Well, index is greater than all index or length minus one.
Then we want to make sure that our model is open, so we'll be calling up our open model.
And apart from open water, we'll be returning zero.
All right, and if not, then we want to just return an index that means our questions are not still
finished.
We want to attempt more questions.
Return index.
All right, so we have set it up our next question now, the last method that we used to up is to check
our answers, whether they are right or not.
So in order to be configuring on next questions.
So consider.
Check answers.
That such a go and it is going to take up a value that we're going to get from.
Abdul GS6.
And now, if that is true, that means the answer is correct, then you want to set correct equals to
it is going to take up Old State.
And add one to that, so all state.
Plus one, so now we are setting up answers, right?
No, let me just get rid of this if value.
Oh, it's an obvious answers, no answers, then we want to move on to next questions and our next question.
All right, so now we have set it up all that we need inside of our provider.
Apart from this, we are old and now we need to just export this data and imported into our different
components and use them now hit save and let us do it.