All right, and once the def server is up and running, I think we could construct our initial patch
images function and that is going to be the function that is responsible for reaching our engineers,
at least the initial function, because there's going to be some refactoring a little bit later.
And also by the end of the video, we're going to set up the environment variable and just so we can
all meet setting the API key in our source code.
And of course, I'll talk about why we want to do that and how we can do that and create react up once
we get there for the time being.
We'll just start with abcess.
We also have and by the way, this is what happens when you have too many windows open.
So close, all of them.
I'm just looking for the objets that is specific to the source and setup.
So let me open this one, because that's the one that we're going to be working on.
Like I said, I would want to start by setting up some kind of function here.
And the name of the function is going to be fetch images.
So we go here with CONSED and then fetch images.
That is our initial function and I would want to use async.
So I'm going to go here, we think.
And as far as the futch functionality, I will set it up and try and catch.
So just to spice things up again, remember we have this try and catch option where we try something
and if that fails and of course we can do something with our error.
And as far as what we want to try, we're going to go with Konstantine.
Response is equal to White since we already have the async and we're going to go fetch.
And then you are now, of course, I haven't constructed the URL yet, so that's why above the try,
we're going to do that.
I'm going to say that there's going to be a property of Europe.
And the reason why I'm using that is because it will change depending on whether we're going to be searching
or we just want to get the default images.
So remember, in our progression, we can get default images like show, where essentially we just load
the application and we're getting some images by default from the splash or there's also going to be
an option of search.
That's why there's going to be multiple URLs.
And for the time being, we'll just start with the simple one where we have the menu URL.
So that's the one where we're getting the photos.
And I would just want to upend that client ID.
So let's go here with your URL and no one will be equal.
Now, of course, since I would want to construct that, you are going to have to use the template literal
where first I'm going to get the main you URL and then remember.
Poor documentation, what do we need to do?
We need to go with a question mark because we already have the force correct.
And after the question mark, we write client an idea that our primer and of course, I would want to
get my value, some of them navigate back where I have the access key and I'm going to copy and paste.
So we have the URL Musim, at least the initial version, and then I would want to wait for a response.
So in this case, again, I will call this data online a wait, of course.
And we're going to go with a response that Jason and we're going to invoke it.
And if there is a natural cancel log the error.
So let's go log and an error like so.
And also, I would want to set up, of course, the user as well as the state values, and we'll have
more state values a bit later.
But for now, we're just going to go with loading since again, we're fudging there.
So might as well start loading right away.
So start loading.
And that one is equal to your state and then we pass in false.
So by default, we won't be loading OK, some.
And then also let's get the photos.
So I say here photos and set photos function so that we'll of course set up the list of photos that
we're getting back by default again, empty.
All right.
And then once we have this one in place where we have such images before the URL, I would want to set
loading to be true moksha.
And then where I have the error, I also want to set it up.
I also want to say that, yeah, if what I would want to set loading files, even if there is an error.
So we're going to go with the loading and that one is equal to false.
And of course what is missing is the use of fact.
So we go here with use the fact and then I would want to run it when?
Well, I would want to run it well out of the app load.
So we're going to go with such images or fetch photos, whatever is the function name, and I'm going
to go with empty.
All right.
And then, of course, for the time being, all just gone.
So log the data just so we can see something in a console.
We can navigate to the bigger browser window, localhost three thousand.
We should have our text.
But what we really care about in a console is of this object.
So for the time being, there's some kind of error.
OK, interesting.
But then we have the object and in here it says, well, the access token is invalid, OK?
And I'll purposely leave these errors because I would want you to see that once you start working with
these external APIs, yes, you might have some bugs, but you don't need to freak out.
You just need to go like, OK, so I've got some kind of error.
So definitely I need to double check whether I'm setting up my Yooralla correctly.
So what we're going to do is go back to the API documentation and scroll up.
I guess we're going to go with list of photos.
And really what I'm looking for is this ossification.
So maybe not even list the photos, which you would want is the public authentication.
And then if I'm checking notes.
The morale that they provide has this parameter of questionmark and then client.
So my access token is correct, the one that I provide.
However, this parameter is not so.
It should be client.
And the reason why I'm showing you that and by the way, I still set it up on correctly should be underscore
is because a lot of times actually were students just get a bit confused the first time they hit there.
Don't be afraid.
Yes.
When you're working with NPR, you might hit some roadblocks, but you just need to double check that
your uttara is correct.
So in this case, once I load now, I should have my 10 images.
Correct, because if we remember documentation and again, I know it's a bit annoying because it's somewhat
big.
So I kind of just scroll up and down essentially.
I'll have to show you that by clicking on links on this, because that is just the photos now.
I have the page, I have per page and I have order by now.
All of them have already some default powers.
That's why we get ten items back.