All right.
And before we start setting up the components that we're going to use to display all the jobs.
Let's talk about the elephant in the room.
I'm talking about the log out user, essentially why it is here, as well as the clear alert.
And let's start with this one.
And let's simply try to understand what kind of errors we possibly might get in the all jobs page.
Unlike the ad job where possibly again, we have the checks on the front end, but possibly you could
get one hundred.
It's not going to be the case with all jobs, and it's not also going to be the case of four or four.
I mean, it shouldn't.
If we build everything correctly, there should be no 400 responses or four offers, even if the filters
return pretty much nothing.
So if I'm going to go here with some kind of gibberish or the worst case scenario, you'll get back
empty your.
And then we will display no jobs to display.
So where I'm going with this.
Possible errors are for a one that I would be on authenticator or 500.
Correct.
The server's down.
So now let's try to understand, does it really make sense for us to go to actions and set up get jobs
error?
And if that is the case, then we display the on authenticated alert or here or we say that the servers
them.
I mean, just like a lot of things in this application.
It is my personal opinion, but if I really hit that 401.
Or we had that 500, then we just log out this year because there's something wrong with our application.
And if we have the 400 or four or four and it's the same deal, we shouldn't be getting those errors
coming back from the server.
Now also, let's remember that when it comes to four or one, the unauthenticated we are already on
over here, so that's taken care of.
But then the rest of the errors, instead of going with some kind of alert, will simply go with log
out user.
Now one gotcha kind of is the fact that.
When we're setting everything up, basically as we're building the project, it might get sometimes
annoying because you might set up the wrong URL.
You might, I don't know, get the four or four or whatever.
And in that case, it's kind of hard to troubleshoot since you're being locked out.
So for time being, I'll just comment them out.
Now I also want to mention, though, that we will do that in other components as well, because the
same goes for that.
I mean, I'm not going to repeat the whole thing, but if you're getting four or four over here, then
there's something wrong with your application.
If you're getting five hundred again, the user shouldn't be in this page in the first place, then
because I mean, there's something wrong with your server.
So hopefully that is clear.
And as far as this console log, I will leave it because again, we all come back to this sucker later.
There's still quite a bit of functionality we need to add.
And yes, in the future requests, again, we'll check what's happening if there is a possible error
that we want to display.
Yes, we'll do that.
If not, then again, it is my preference to go with logout users.
Just keep in mind that for all of them, I will comment them out because like I said, when you're developing,
I noticed that it can get quite annoying where you just basically log yourself out and then it's kind
of hard to troubleshoot.
That's just something that I noticed when I was building.
Now what about this guy?
What about clear alert?
Because at the moment, you can take a look at the reducer and you're going to be like, What are you
talking about over here?
I mean, we're not setting up the alert or anything like that.
We actually hide the alert in our jobs begin.
Why are we clearing?
Remember that, first of all, when it comes to our alert.
We have that delay, again, that was my preference.
And then what I noticed initially here, I did have the alert marked.
So instead of the spinner and this one, I was using the alert.
And what I noticed that if you had a job here and since this one is sitting here for whatever those
two, three seconds or whatever, if you're quickly go to jobs, then that alert still displays the
whatever is the value, the new job created or whatever you went through.
And that's why I added those checks when I said, Look, once I start fetching it right away, I'm going
to hide it, meaning once we go eventually to that page, we'll right away hide it.
And the same goes over here where it's just my precaution when I say, Look, if there is any alerts,
let's just hide it.
Technically, you can remove them both and everything is going to be fine because I can tell you that
there will be no alert over here.
Again, I was just when I was initially testing, but I do want to mention that if you will set up some
kind of alert system over here, then remember, since these ones are persistent for a little bit longer.
Again, those two three seconds, that little bit of delay.
That's why they will be displayed also in a different pages if you quickly navigate.
Again, it's not going to be our scenario.
We're not going to do.
But that's why I added the clear alert as well as in the reducer, the show alert false.
So long story short, when it comes to the errors, in my opinion, it's better in this case to log
out the user if we're hitting any of the errors because it doesn't make sense.
We shouldn't be getting those errors in the first place.
It's not like with empty values in the Anjam, and when it comes to clearing alert, this is just a
precaution.
If you do have eventually the alert component in the all jobs page or stats page, which in our case,
we won't.
So technically, if you don't want to use them, you can just.