Now that we understand that we need to worry about this whole domain issue inside of get initial props.
We need to figure out whether we are inside the browser or the server when we're trying to make a request
in there so we can adjust the domain accordingly.
So how are we gonna do that.
Well it turns out that next J.S. used to have a really convenient function that we could use to figure
out very easily whether we are in a browser or server environment.
However that little function was removed recently.
So instead we have to rely upon a really kind of silly fallback as you can tell.
I'm a little bit sore that that function was removed out of Next j us but that's life so inside a get
initial props.
Again we have to decide whether we are on the server or the browser to do so.
We're gonna write out if typeof window equals equals equals undefined window is an object that only
exists inside the browser the window object does not exist inside of a No j ust environment.
So if the window variable is undefined inside of well this code that is getting executed somewhere that
must mean we are on the server.
And so any request that we make inside of get initial prompts requests should be made to HDTV and then
that whole really long you are L something like What is it ingress engine X dot ingress dot or dash
engine X blah blah blah all that other stuff we can then add on an L case.
So if window is defined then that means we are on the browser and requests can be made to HDTV or really
we can we can say can be made with a base you are all of just empty string.
And again we will rely upon the browser to put on the base domain or the base rule for us.
So that's it.
That's how we're gonna decide whether we are on the server or the client.
So now that we've established this quick pause right here can make the next video and we're gonna finally
finally make our request.