You might get an interview, the question, right, an example of fetching data from Italy was similar
to DP request.
And actually, this is a super old question.
And normally people should not ask this question nowadays on interviews.
But still, I'm hearing this question really a lot because some people still want to know how we solved
our and problems 10 or 15 years ago.
In the modern projects, you will never, ever use extreme electricity you request natively.
This is why it doesn't make any sense to ask this question, but we must learn how to answer it.
This is why let's write an example how it is working.
So first of all, we must create our our request.
So this is why we're calling you example issue type request.
Now we have an instance of our simplicity request and we can say what method of a one percent and on
Batgerel.
This is where we are right an exceed chair open.
And as you can see here, we have two parameters.
First of all, its method here we want to write Ghent because we're making against request.
And here is our EPA URL and they will paste here and the power yourself from GitHub.
Com to fetch all repositories of this specific user.
After this, we're right in each hard dot send and groundbreakers, but it is not all but also must
specify what will happen on success and on error.
And for this, we're writing Exige Dot Onlythe.
And here we must assign a function and inside this function.
First of all, you want to check what status we're getting back.
So we right here, you fix.
Each hard dot status doesn't equal 200, which means it is not successful then for one to console some
error.
So I want to write here, for example, aero glass and maybe our status glass and here exceed chart
status text.
In this case, we can directly see what problem we have.
In the case.
We're getting success.
So here we will write console.log success.
And after this, we want to read our Excel chart daughter response.
But inside we have our answer, and we also want to check for the error inside the request.
So here we can try to search hard dot on Arrow and just to remind you everything is lowercase and we
sign here a function.
And inside we can write.
For example, console.log excel chart request failed.
So this is how you typically define the search function.
First of all, we create an instance of similar request.
Then we make an open with our method and yourself.
Then we write get send and then we have Unltod function and on there a function to handle both incorrect
statuses when there was a request.
Now let's check if it's working.
I am jump into browser and relied on the page and as you can see here, we getting our response and
we're getting our console.log success also in our network.
You can see that we have a request wrappers and this is the actual request.
And as you can see, this is our preview.
So this is our response from the backend, and this means that we successfully implemented our fetch
request by using the simplicity of the request.