Beautiful.
And once we can remove the drum, it's also set up the functionality on a end where we can edit the
job.
Now the biggest difference between the two is the simple fact that when it comes to delete, we're actually
calling this in the component that if you remember when it comes to edit, we navigate to our job and
this is where we set up the functionality.
This is where we invoke the ad job or added job in the ad up page.
And where I'm going with this.
Well, remember, first of all, you have here of the alert and second, when it comes to error.
This is also where we'll display it.
So long story short, yes, in this case, we'll have all of them.
We have added jump again the success as well as the error, simply because we're working in a different
component when it comes to invoking the functionality here with the way it was in the old jobs, and
I'll be switching to the added job.
So let's take a look at the read me.
What are the steps?
And essentially, here's what I want to do.
First, we want to set up the actions in the action address.
So on, we're at a job against success on our career.
That makes sense.
Then we have our added job function where we dispatch at a job again, which will set up the loading
van.
Remember, all of our values are already in the state.
The positions companies everything up to the status, so we're just it out of a state and land the same
deal.
We got jobs and in there we need to pass in the prime, the job.
And where is it sitting there, just sitting in the edit jump?
Either you pull it out here when we're restructuring or it can just go and stay dot and then had a job
since I already have the flowers in front and we might as well send them now.
In some cases, the user will change the rules.
In some there will be equal to the defaults we already have on a server that is irrelevant.
What we need to do from the front end is pass all the data just in case the values are different than
the ones on a server.
And then we'll dispatch added job success, which essentially introducer just sets up the alert, so
alert true success and we'll just say job updated.
So user knows, OK, everything works.
And also, I want to dispatch clear values because if everything is correct.
Well, I don't want that at a job.
They're lingering around.
I just want to set it back to default.
Then we have also error.
This is going to be the case where if we have 401.
We're not going to display that.
I'm not going to repeat why we're doing that.
Please go to the previous videos where I covered up a much greater detail.
And if the error is not for one, then we dispatch there.
It might be a value missing or something along those lines.
But let me just double check.
I believe that on the front end, we're checking for all the values.
Let me quickly navigate there.
I'm looking for two pages and I want to look for an odd job, and let's see.
Yeah, no rush here, so I'm checking for two empty hours, so the chances of some kind of error are
obviously much slimmer right now if we remove this than we definitely contested.
OK?
So let's do it.
We're going to first go to the actions and let's see which one I can quickly grab.
So added, I'm going to take these ones.
Now I just need to challenge the creator over here, so let me so let this one select all of them,
and we're just going to go at it.
We have this wandering place than we want to go to this reducer.
Now, I'm not going to set up the logic right now, but I'll just start by getting all of them sort
of begin.
Then I want success.
And I also want our van.
Let me take all of them.
And back in the app context.
Also, let's import them.
And let's keep on scrolling, and what we're looking for is the added jump.
And let's set up the functionality.
First thing we want to do in this patch and we're going to dispatch type and begin type will be equal
to edit job and begin.
So we'll set up the loading OK, then we want to go and try and catch.
Let's go with the cast.
And let's pull out of ours.
So I'm looking for a position and all of that will be coming from the state.
So position first one company than a job.
Location and also job type and the status.
Again, if you want to pull out the I.D. as well, you can definitely do so in my case.
We're going to go stay dot.
Then we want to go with a weight and remember, we're not really looking for that response.
So let me double check my controller.
So we are sending back the updated job, but we really don't care about it because if everything is
correct, we'll just display the message and remember when we navigate back to all jobs will refresh
the jobs anyway, and then we'll see that there.
Hopefully that makes sense.
So let me go back to context again.
We're not going to assign this to any kind of variable because I'm just waiting for this to complete.
So we're going to go here with OFSUCH.
One remember, the method is patch, and then we need to pass in the Yoro in this case, since I'll
be providing the interpolation.
I also want to go with template strings.
We set up jobs online, let's access state online.
We're looking for edit job and then I'd have me double check just so there are no silly bugs.
So edit job video make sure it's exactly the same because I'm an expert on making such a small typo.
So yeah, it's about right.
And.
Since we have the patch functionality, we need to pass in some data.
Now, what a while on a passing company position.
Also, a job location sounds nice, van, I also want to pass in the job type.
Lastly, let's go with starters, let's save it.
And if everything is correct, I want to wipe out the value now in this case again.
My apologies.
For some reason, I keep forgetting that this is a sink.
So let's go here with a sink.
This should fix the error.
And remember, once we are successful, I also want to set it back to default when it comes to our job.
And if you remember, we already have the action for that and that one is clear.
So we wait for this one to complete and then we go with this batch and then let's just go with type.
And I'll set it equal to clear.
Let's save it, and let's do the whole song and dance with our response.
First of all, if it's for a one that I don't want to spread the word, so we're going to go with our
then response and we're looking for status.
And if that one is equal to for a one, then simply return, then I want to dispatch if it's not for
one.
For example, if it's 400, in this case, we're going to go type that is equal to edit job and are
not begin looking for the error.
And then let's pass in the payload.
We're going to go here with a object and set up a message, and let's set it equal to our response then
data.
That's where it's going to be sitting.
And the message?
And once we have the error in place, I'm noticing that actually skipped one step, not at a job success.
Now, unlike the alert, we're not going to pass anything here in the payload, but we still want to
dispatch it to go in this batch.
When we're looking for type and we're going to go with added job and success, essentially with this
one, we're just setting up that alert.
And when it comes to clearing devours, well, we already know that we're going to do that with the
next dispatch.
And then since I want to hide those alerts, I'm going to go with clear alert and then let's invoke
it.
And with this in place now, let's navigate to the reducer.
And I don't know which one I can copy, which is going to be faster.
I think I'm going to take the set up user error because I mean, most of them will be based on that.
So with me, navigate down here, copy and paste.
Now the action that I'm looking for is a job and then begin with take this one, edit on the score job
again.
But you know, before we do anything, going to copy and paste because there's a bunch of things are
going to be exactly the same.
So at a job begin, let's just leave it as far as loading.
But let's set it up as true.
So when we performed this request, it's going to be loading.
That's going to be the beginning one, then as far as the success or we just want to display the message,
that's why we're not passing anything and there's really not much to pass.
So in here, let's just say, is loading false?
True.
It's not going to be a danger.
It's actually going to be success.
But what's again, copy and paste, because this actually matches exactly what we need for the error.
And let me fix this one quickly.
So alert text will be job and not updated.
That's the exclamation point.
And then let's say here, success.
Let's save this.
And lastly, what about the error?
Well, pretty much already have all of the code we go with state loading, false show or true danger.
And where is the message sending in the message?
Probably.
Let me go back to my application.
I'm looking for all my jobs.
Let's say that I want to edit this one.
The intern and Apple, and I'll start by changing the status.
I'm going to go to interview.
Maybe let's also change the position.
It's going to be a front end one.
And the job location, well, for the time being, let's just leave it as a in Mexico.
Let's submit ours.
We have job updated and we set back your different values and that if I take a look at all the jobs,
not ours, it is front end.
It is a full-time one.
It is actually an interior because we change our value as well, and we're good to go.
And if, for example, I decide that I'm also going to do the same thing with the back on one, maybe
let me change the location.
I'm going to go here with Brazil.
If everything is correct, then we have job updated.
We switch back to our jobs.
Basically, we set it back to the default, and now this one is the Brazil one.
And lastly, let me just mention.
The reason why we didn't need important, I think.
As far as the outer job is, because when we were setting it up as a placeholder, meaning when we just
had the silly console.log, we already did that in the sonar.
We already have the import 40 at a job in the AJAB and we also invoke it if we are editing.
And that's why we didn't need to repeat anything.
We were simply able to go to front them and test it out.
And with this in place now, we have a complete delete and added job functionality in place.