1
00:00:00,960 --> 00:00:07,530
And once we have both the added job as well as the lead job functionalities on the server.

2
00:00:07,980 --> 00:00:15,030
Well, let's implement them on the frontline because at the moment have the buttons and I can clearly

3
00:00:15,030 --> 00:00:19,500
see that I'm getting the the job as well as the idea.

4
00:00:20,370 --> 00:00:27,870
And the same goes for the added one, where we navigate Julie and John Page, but I mean, there's not

5
00:00:27,870 --> 00:00:29,610
much more functionality.

6
00:00:30,600 --> 00:00:36,090
And the way it's going to look like if we go to the read me or say the first thing, we want to create

7
00:00:36,090 --> 00:00:41,130
the action and yes, I'll start with delete because it's going to be a bit more straightforward and

8
00:00:41,130 --> 00:00:43,590
the action name will be delete and jump again.

9
00:00:44,100 --> 00:00:45,480
And yes, I'll talk about it.

10
00:00:45,750 --> 00:00:52,980
Well, why don't we have the success as well as the Iran one in the context where I have the function?

11
00:00:53,430 --> 00:00:59,100
First, I want to start with the lead job again, and it's probably not going to be the surprise that

12
00:00:59,100 --> 00:01:02,430
when it comes to begin one, we'll just start with loading.

13
00:01:02,790 --> 00:01:08,370
So I want to display that loading spinner since we'll set up the request, then we want to go with a

14
00:01:08,370 --> 00:01:14,520
wait and notice how we're not getting any data back because again, when it comes to deletion, I mean,

15
00:01:14,520 --> 00:01:16,210
we're really not looking for any data.

16
00:01:16,470 --> 00:01:18,480
We just want to know whether it worked or not.

17
00:01:18,780 --> 00:01:25,710
So if we're successful, we'll keep reading the code effectively, will invoke, get jobs and I'll talk

18
00:01:25,710 --> 00:01:26,580
about it in a second.

19
00:01:26,940 --> 00:01:30,180
If not, then we'll go to the error.

20
00:01:30,840 --> 00:01:35,950
So therefore, we're not looking for any data not assigning it to any variable or nothing like that.

21
00:01:35,970 --> 00:01:37,860
I just go off fetch.

22
00:01:38,130 --> 00:01:42,630
Now the method is delete, because that is what the server is looking for.

23
00:01:42,900 --> 00:01:43,920
And then what is the path?

24
00:01:44,280 --> 00:01:45,480
It is jobs.

25
00:01:45,720 --> 00:01:47,310
And then I grabbed a job I.T..

26
00:01:48,210 --> 00:01:50,520
That's why we were passing this in.

27
00:01:51,100 --> 00:01:53,280
Now why we need get jobs.

28
00:01:53,550 --> 00:01:55,200
Well, when I'm declining.

29
00:01:55,680 --> 00:01:57,810
I'm not deleting from the local state.

30
00:01:58,290 --> 00:02:03,890
The one that I have here in the components where I'm deleting the jobs from, from the database.

31
00:02:05,670 --> 00:02:09,419
So I don't want this to be out of sync.

32
00:02:10,080 --> 00:02:17,340
So essentially, once I believe the job on a database, I actually want to make another request where

33
00:02:17,340 --> 00:02:25,650
I get the latest jobs and therefore we go here, we get jobs function, which we already have in context.

34
00:02:25,740 --> 00:02:31,470
Hopefully that makes sense because that's the function we invoke once we navigate to the old jobs.

35
00:02:32,040 --> 00:02:37,560
Now, when it comes to error again, we don't have here any kind of alert.

36
00:02:38,160 --> 00:02:45,960
So I didn't really see the point of updating the alert if there is an error, if I'm not showcasing

37
00:02:45,960 --> 00:02:46,500
the alert.

38
00:02:46,770 --> 00:02:48,300
What is really the point?

39
00:02:48,750 --> 00:02:56,610
And again, it comes down to the fact what do you want to do if you have 500 or let's say, 401?

40
00:02:56,820 --> 00:03:02,940
Again, we're handling 401 already here with the interceptor, but in my opinion, there's really no

41
00:03:02,940 --> 00:03:07,950
point to, I don't know, showed the alert with 500 error, in my opinion.

42
00:03:07,950 --> 00:03:14,940
Then we might as well rather log out the user and then I'll come on this one and why we're working because

43
00:03:14,940 --> 00:03:20,400
it can get a little bit annoying if you're get logged out while you're testing stuff.

44
00:03:20,400 --> 00:03:23,250
But eventually, yes, this will be in place.

45
00:03:23,250 --> 00:03:29,580
And therefore we only have the lead job again because there's no success message.

46
00:03:29,880 --> 00:03:32,040
And there's also no error message.

47
00:03:32,400 --> 00:03:34,110
So let's start working on that.

48
00:03:34,110 --> 00:03:37,620
And I guess I'm going to go first to the actions.

49
00:03:38,960 --> 00:03:41,390
And we want to go with that, the lead up again.

50
00:03:41,840 --> 00:03:49,040
So let me copy and paste this sucker over here, and I'm going to go with my two cursors and let's just

51
00:03:49,040 --> 00:03:53,900
go with delete, delete, underscore job and begin.

52
00:03:54,360 --> 00:03:55,040
Save it.

53
00:03:55,620 --> 00:03:59,810
Let's start, I guess, you know, introducer, there's going to be less code there.

54
00:04:00,470 --> 00:04:04,610
So we're just going to go here with delete and job again.

55
00:04:04,940 --> 00:04:08,450
Then we want to check here for the condition.

56
00:04:08,840 --> 00:04:17,269
So say here, if action type is equal to an important delete job and begin, I'm like, I said, we

57
00:04:17,269 --> 00:04:21,880
simply want to set up that loading one, since there's going to be a request.

58
00:04:21,890 --> 00:04:25,220
I mean, we might as well display the loading spinner.

59
00:04:25,940 --> 00:04:27,860
So we're going to go with that, not state.

60
00:04:28,400 --> 00:04:33,830
And then we want to pass and is loading and set that one equal to true one.

61
00:04:34,740 --> 00:04:36,060
We want to save here.

62
00:04:36,540 --> 00:04:41,190
So let's save everything, and my mistake actually closed the file, that's OK.

63
00:04:41,640 --> 00:04:46,290
And in the app context, let's also right away grab that lead jump.

64
00:04:46,590 --> 00:04:50,580
So the lead job say that I want and not.

65
00:04:50,580 --> 00:04:55,580
Let's look for our functionality where we have the job.

66
00:04:55,590 --> 00:04:59,280
Like I said, work in the a job for the time being.

67
00:04:59,730 --> 00:05:02,070
I just want to show that we have to get jobs.

68
00:05:03,010 --> 00:05:06,130
So this is where we'll add a little bit more functionality eventually.

69
00:05:07,070 --> 00:05:12,140
Meaning there's going to be more stuff in here on top when we're setting up the URL.

70
00:05:12,590 --> 00:05:16,850
But the idea is that we just get all the jobs from the database.

71
00:05:17,180 --> 00:05:24,170
And that's why when we remove the job, we want to get back the latest jobs that we have in the mango.

72
00:05:24,560 --> 00:05:31,690
Hopefully, that makes sense on first, like I said, go dispatch, then we want to go with type now,

73
00:05:31,730 --> 00:05:39,020
be equal to the elite job again, then we want to go and try catch on this point.

74
00:05:39,020 --> 00:05:44,630
I think I can remove the console because I'm pretty sure that we already know what's in there.

75
00:05:44,870 --> 00:05:45,710
So that's the job.

76
00:05:46,400 --> 00:05:53,780
Then let's go with a white one off patch since we want to get that base URL as well as the interceptors

77
00:05:54,110 --> 00:05:55,040
and then delete.

78
00:05:55,190 --> 00:05:59,080
And now we're going to have to go with a temperature check.

79
00:05:59,980 --> 00:06:05,350
Because we're going to go to jobs going forward, slash and specifically.

80
00:06:05,620 --> 00:06:08,300
So job, Heidi over here.

81
00:06:08,860 --> 00:06:15,420
And of course, in here, I didn't name this as drama, so I may just change around the parameter.

82
00:06:15,430 --> 00:06:18,020
And let's say that that is a already.

83
00:06:18,280 --> 00:06:20,200
I think it's a bit more explicit.

84
00:06:20,770 --> 00:06:26,020
And then, like I said, once we're successful, we want to go get jobs.

85
00:06:26,020 --> 00:06:29,170
So we want to invoke this function, get back to latest jobs.

86
00:06:29,560 --> 00:06:37,330
And for time being, I'll do two things a log error and a response just in case there is one.

87
00:06:37,690 --> 00:06:43,970
And then I'll go with a log out user and I'll invoke it, but I'll come on this one up again.

88
00:06:44,320 --> 00:06:49,960
I will make sure that all of them are in place once we're ready to go to production.

89
00:06:50,260 --> 00:06:53,440
And if for some reason I forget about that, please remind me.

90
00:06:53,800 --> 00:06:54,700
And here's the thing.

91
00:06:55,630 --> 00:06:57,430
We already have the function.

92
00:06:58,540 --> 00:07:01,870
That was the whole point why we're setting up that placeholder.

93
00:07:02,530 --> 00:07:05,950
We already have a dashboard where we have all jobs.

94
00:07:06,370 --> 00:07:08,350
The daily job functions are in place.

95
00:07:08,680 --> 00:07:11,230
Now, of course, that is in the jobs container.

96
00:07:11,410 --> 00:07:19,360
If I take a look at the single job, I will see that I'm looking for my delete job right here.

97
00:07:19,600 --> 00:07:21,040
That's the function that I'm working for.

98
00:07:21,280 --> 00:07:28,060
So now I can simply test that out where I have five jobs, which matches exactly what we completed in

99
00:07:28,060 --> 00:07:28,810
the previous video.

100
00:07:28,870 --> 00:07:32,860
Remember, we deleted one job, so now let's just try out.

101
00:07:32,860 --> 00:07:34,810
We had some jobs here or something.

102
00:07:34,810 --> 00:07:35,950
Something is going to go.

103
00:07:36,870 --> 00:07:42,660
And, you know, it looks like I'll have to refresh, and here it complains that we have a weight on

104
00:07:42,660 --> 00:07:42,820
you.

105
00:07:43,380 --> 00:07:43,860
Of course.

106
00:07:44,100 --> 00:07:48,690
Let me navigate back to my amp context and I messed it up a little bit.

107
00:07:48,690 --> 00:07:53,910
Where this one should be, I think probably should have set it up right away from the get go.

108
00:07:54,180 --> 00:07:59,160
Now let me serve it, and I'll let me try one more time where we're going to go with something, something.

109
00:07:59,400 --> 00:08:00,300
And what do you know?

110
00:08:00,660 --> 00:08:03,600
I don't have any more of that job in a database.

111
00:08:03,950 --> 00:08:09,840
Now I have only four of them, and you can probably already guess that if I'm going to keep on removing

112
00:08:09,840 --> 00:08:16,410
the jobs, then I'll be removing them from the database and will be performing those fetch requests

113
00:08:16,770 --> 00:08:18,750
to get the latest jobs.

114
00:08:18,900 --> 00:08:23,130
And with this in place, we have completed the delete job functionality.

