Okay, so now let's go and test it out.
Our profile should be already working.
So we have this user read only as far as our job go here with.
Frontend dev and then google.
This should fail.
Yep, that's the user only.
Take a look at the all jobs.
We don't want this user to modify it, test the user only and then all jobs.
We also don't want this user to delete.
Hmm.
And it looks like in here I have a tiny bug.
So let me go back to the context.
If I take a look at the job, I can see that I'm logging out the user.
And actually that is not what I want to do.
I want to set it up the same as I have for the edit job.
So in here, let me take these lines of code.
So take this.
Remove that log out user again, things have changed now now we have test are normally yeah that's the
case.
If we have any kind of error we want to log it out.
But since we might possibly have this 400 error now, we need to handle that as well.
So if it's 401 we return because remember that one gets handled in the interceptors and here we want
to change it.
It's not going to be added job error, it's going to be delete job error.
So first let's start in the actions.
So copy and paste here.
And I'll say the lead job.
So change it here as well.
It's going to be exported.
So we want to go to app context.
And we want to import that.
So go with the lead job.
An error and effectively the functionality is going to be exactly the same as with.
At a job.
Just want to change this one.
To put weight in here, we'll access the same thing, the response data message and all of that.
And now let's go to reducer.
I want to just add that functionality.
So we have if at a job error, we simply want to take this whole thing and then place it before the
success.
Sorry, we want to place it to right after again so we have is loading true and we just want to set
is loading false alert danger and then the message.
So let's go here with the weight and job and error.
Let's say that let's refresh.
We have not defined.
Okay.
So we need to import this one as well here.
My bad.
So we have the lead job and we're looking for error.
Let's save it.
And the last thing we want to do is to add alert now in the jobs page, because previously there was
no need for it and now we actually do need to add the alert.
So let's go to the jobs container.
Remember this is the logic, correct?
So for loading with display loading, then if there are no jobs, we display the wrapper.
So now we want to place the alert somewhere here in this wrapper.
Just keep in mind that we still need to import alert and we also need to get from the context the show
alert because this is what we're setting.
In the reducer.
So we go delete jab, error, release, loading false, true, and then alert type.
And we also pass in the payload.
So back in the jobs controller or I'm sorry.
Got a little messed up job's container.
We want to grab the chocolate from the context.
We also want to get the alert.
So let me change this around.
And.
You want to get this one from alert?
Let's keep on scrolling.
And then right at the top over here, we want to set up the condition or we will say show alert.
If it's true, then we want to render the alert component.
Pretty much the same as in the rest of the components.
And lastly, in the app context, we also want to add clear alert.
When I was copying pasting the delete job setup, I actually forgot to do that.
So let me grab this clear alert.
And then right after the catch, we will invoke it.
And now let me refresh and let's try one more time where once we click on edit.
We shouldn't be able to if we have test users and if we try to delete and we have test user read only
and then obviously after a little bit of time, it disappears.
And with this in place, we're done with the test user and we can move on to the next piece of functionality.