All right, and now it's complete everything by setting up the create job functionality where essentially.
We go to the complete project, and if I had some kind of data here, let's say again, I'm going to
go with that something.
So let's say here's something with Mangun copy and paste in my clipboard.
I believe these values pretty much the same.
Or, you know, I might just change all of them.
And then once we submit, if everything is correct, we get new job created and then we'll clear out
the values since we already have the functionality.
And then if I go back right now to the all jobs knowledge that I have, that's something drop something,
something.
That's the latest job and or here as far as the value it is A..
So essentially, instead of using the postman, we'll actually use our frontend and we'll start by creating
the reactions create job, begin success and error.
And then there's going to be a create job function, and I'll come back to that one in the second.
But if we keep on scrolling in the add job, we'll get the create job function and then we'll check
for the empty hours.
If we do, then we display alert and then we'll also right away check for is editing.
So eventually we'll go with added job.
And again, keep in mind, this is false by default.
All the way here in the bottom will invoke create job.
So have two checks, one for empty values, which we will comment out right away just so we can test
the error responses from the server.
And we'll also check for is editing, which at the moment is false, but eventually we'll invoke at
a job as well.
And then as far as the functionality, well, that's how create job function and right from the get
go will dispatch create jobs again.
And you probably already know what we're going to do.
We'll set up the loading one, then we'll grab these values from the state.
So position company and everything that is required and will pass it in.
So go off edge, but notice how we're not looking for response.
So that's the thing.
When we create the job, it's not like I'll display the job that I created.
We have a separate page where I'm fetching all the jobs anyway.
So once we add the job, I mean, I'm not really looking for a sponsor on the front.
I just want to see whether everything worked.
Meaning in here, I'll just go, wait, and then I'll dispatch to create job success, which in turn
will set up that alert with the success message.
That's it.
Then we want to clear the values and we have multiple options.
You can either go with clear values, function or in this case, I'm just going to go with dispatch.
And then again, we have a error one.
And in this case, I'll show you alternative approach, where essentially if the status one is for a
one, we just return.
And if it's not worth one than we dispatch the error, for example, please provide home values, which
would be a 401.
And I'm not going to cover one more time to things.
I'm not going to cover the fact that if we have 401 one since we're using Auth, remember we automatically
log out the user that's number one.
And second, the reason why we go here with the return is simply because I don't want that alert hanging
around since we are removing it in 30 seconds.
Again, that's something we covered, so I really don't want to repeat myself.
Let's keep on scrolling.
And then as far as the reducer, like I said, when we create job is loading.
It's true that if everything is correct, I really don't need to update much interstate, simply want
to go alert type success.
And yes, of course, loading and show alert.
And as far as the text, well, it's going to be new job creator that's up to you or whatever you want
to set up as far as the value.
And what about the error?
Well, this should definitely be familiar.
We just said is loading false than we want to show the alert and then danger and then whatever message
we're getting back from the server.