1
00:00:00,240 --> 00:00:03,120
Okay, so now let's go and test it out.

2
00:00:03,930 --> 00:00:06,689
Our profile should be already working.

3
00:00:06,960 --> 00:00:11,700
So we have this user read only as far as our job go here with.

4
00:00:12,750 --> 00:00:16,350
Frontend dev and then google.

5
00:00:16,350 --> 00:00:17,320
This should fail.

6
00:00:17,340 --> 00:00:18,900
Yep, that's the user only.

7
00:00:19,140 --> 00:00:20,490
Take a look at the all jobs.

8
00:00:20,490 --> 00:00:26,210
We don't want this user to modify it, test the user only and then all jobs.

9
00:00:26,220 --> 00:00:28,440
We also don't want this user to delete.

10
00:00:28,890 --> 00:00:29,280
Hmm.

11
00:00:29,550 --> 00:00:32,580
And it looks like in here I have a tiny bug.

12
00:00:32,670 --> 00:00:35,040
So let me go back to the context.

13
00:00:35,940 --> 00:00:41,190
If I take a look at the job, I can see that I'm logging out the user.

14
00:00:41,460 --> 00:00:44,730
And actually that is not what I want to do.

15
00:00:44,730 --> 00:00:49,290
I want to set it up the same as I have for the edit job.

16
00:00:50,070 --> 00:00:52,890
So in here, let me take these lines of code.

17
00:00:53,310 --> 00:00:54,720
So take this.

18
00:00:55,670 --> 00:01:01,520
Remove that log out user again, things have changed now now we have test are normally yeah that's the

19
00:01:01,520 --> 00:01:02,120
case.

20
00:01:02,120 --> 00:01:04,640
If we have any kind of error we want to log it out.

21
00:01:04,640 --> 00:01:11,960
But since we might possibly have this 400 error now, we need to handle that as well.

22
00:01:11,960 --> 00:01:18,500
So if it's 401 we return because remember that one gets handled in the interceptors and here we want

23
00:01:18,500 --> 00:01:19,610
to change it.

24
00:01:19,610 --> 00:01:24,320
It's not going to be added job error, it's going to be delete job error.

25
00:01:24,560 --> 00:01:26,660
So first let's start in the actions.

26
00:01:27,170 --> 00:01:29,120
So copy and paste here.

27
00:01:30,280 --> 00:01:33,190
And I'll say the lead job.

28
00:01:36,000 --> 00:01:38,940
So change it here as well.

29
00:01:39,660 --> 00:01:41,030
It's going to be exported.

30
00:01:41,040 --> 00:01:44,760
So we want to go to app context.

31
00:01:45,640 --> 00:01:47,050
And we want to import that.

32
00:01:47,410 --> 00:01:50,530
So go with the lead job.

33
00:01:51,450 --> 00:01:57,630
An error and effectively the functionality is going to be exactly the same as with.

34
00:01:59,010 --> 00:01:59,850
At a job.

35
00:02:00,420 --> 00:02:01,830
Just want to change this one.

36
00:02:01,830 --> 00:02:10,259
To put weight in here, we'll access the same thing, the response data message and all of that.

37
00:02:10,440 --> 00:02:12,630
And now let's go to reducer.

38
00:02:12,630 --> 00:02:14,700
I want to just add that functionality.

39
00:02:15,000 --> 00:02:23,130
So we have if at a job error, we simply want to take this whole thing and then place it before the

40
00:02:23,130 --> 00:02:23,910
success.

41
00:02:24,270 --> 00:02:30,900
Sorry, we want to place it to right after again so we have is loading true and we just want to set

42
00:02:30,900 --> 00:02:35,340
is loading false alert danger and then the message.

43
00:02:35,670 --> 00:02:39,440
So let's go here with the weight and job and error.

44
00:02:39,690 --> 00:02:43,290
Let's say that let's refresh.

45
00:02:43,290 --> 00:02:44,670
We have not defined.

46
00:02:44,700 --> 00:02:44,940
Okay.

47
00:02:44,940 --> 00:02:46,950
So we need to import this one as well here.

48
00:02:47,190 --> 00:02:47,700
My bad.

49
00:02:47,700 --> 00:02:53,490
So we have the lead job and we're looking for error.

50
00:02:53,910 --> 00:02:54,840
Let's save it.

51
00:02:55,080 --> 00:03:03,300
And the last thing we want to do is to add alert now in the jobs page, because previously there was

52
00:03:03,300 --> 00:03:07,320
no need for it and now we actually do need to add the alert.

53
00:03:07,590 --> 00:03:10,980
So let's go to the jobs container.

54
00:03:11,810 --> 00:03:14,150
Remember this is the logic, correct?

55
00:03:14,150 --> 00:03:19,220
So for loading with display loading, then if there are no jobs, we display the wrapper.

56
00:03:19,220 --> 00:03:23,870
So now we want to place the alert somewhere here in this wrapper.

57
00:03:24,080 --> 00:03:31,220
Just keep in mind that we still need to import alert and we also need to get from the context the show

58
00:03:31,250 --> 00:03:33,500
alert because this is what we're setting.

59
00:03:34,380 --> 00:03:35,730
In the reducer.

60
00:03:35,970 --> 00:03:41,850
So we go delete jab, error, release, loading false, true, and then alert type.

61
00:03:41,850 --> 00:03:44,370
And we also pass in the payload.

62
00:03:44,760 --> 00:03:48,180
So back in the jobs controller or I'm sorry.

63
00:03:49,000 --> 00:03:52,890
Got a little messed up job's container.

64
00:03:52,900 --> 00:03:55,660
We want to grab the chocolate from the context.

65
00:03:55,990 --> 00:03:57,880
We also want to get the alert.

66
00:03:58,830 --> 00:04:01,020
So let me change this around.

67
00:04:02,080 --> 00:04:02,950
And.

68
00:04:04,030 --> 00:04:05,740
You want to get this one from alert?

69
00:04:06,730 --> 00:04:07,990
Let's keep on scrolling.

70
00:04:07,990 --> 00:04:14,680
And then right at the top over here, we want to set up the condition or we will say show alert.

71
00:04:14,710 --> 00:04:19,899
If it's true, then we want to render the alert component.

72
00:04:21,110 --> 00:04:24,370
Pretty much the same as in the rest of the components.

73
00:04:24,380 --> 00:04:30,240
And lastly, in the app context, we also want to add clear alert.

74
00:04:30,260 --> 00:04:36,290
When I was copying pasting the delete job setup, I actually forgot to do that.

75
00:04:36,350 --> 00:04:38,750
So let me grab this clear alert.

76
00:04:39,350 --> 00:04:43,910
And then right after the catch, we will invoke it.

77
00:04:44,100 --> 00:04:51,020
And now let me refresh and let's try one more time where once we click on edit.

78
00:04:52,090 --> 00:04:58,660
We shouldn't be able to if we have test users and if we try to delete and we have test user read only

79
00:04:58,660 --> 00:05:03,370
and then obviously after a little bit of time, it disappears.

80
00:05:03,580 --> 00:05:10,210
And with this in place, we're done with the test user and we can move on to the next piece of functionality.

