1
00:00:00,150 --> 00:00:06,000
All right, and now it's complete everything by setting up the create job functionality where essentially.

2
00:00:07,250 --> 00:00:13,910
We go to the complete project, and if I had some kind of data here, let's say again, I'm going to

3
00:00:13,910 --> 00:00:15,050
go with that something.

4
00:00:15,470 --> 00:00:19,850
So let's say here's something with Mangun copy and paste in my clipboard.

5
00:00:20,180 --> 00:00:23,690
I believe these values pretty much the same.

6
00:00:24,110 --> 00:00:25,970
Or, you know, I might just change all of them.

7
00:00:26,210 --> 00:00:32,659
And then once we submit, if everything is correct, we get new job created and then we'll clear out

8
00:00:32,659 --> 00:00:34,970
the values since we already have the functionality.

9
00:00:35,270 --> 00:00:43,460
And then if I go back right now to the all jobs knowledge that I have, that's something drop something,

10
00:00:43,460 --> 00:00:43,910
something.

11
00:00:44,150 --> 00:00:49,160
That's the latest job and or here as far as the value it is A..

12
00:00:49,340 --> 00:00:57,320
So essentially, instead of using the postman, we'll actually use our frontend and we'll start by creating

13
00:00:57,680 --> 00:01:01,670
the reactions create job, begin success and error.

14
00:01:02,090 --> 00:01:08,840
And then there's going to be a create job function, and I'll come back to that one in the second.

15
00:01:09,290 --> 00:01:16,430
But if we keep on scrolling in the add job, we'll get the create job function and then we'll check

16
00:01:16,430 --> 00:01:17,510
for the empty hours.

17
00:01:17,780 --> 00:01:22,490
If we do, then we display alert and then we'll also right away check for is editing.

18
00:01:23,000 --> 00:01:25,520
So eventually we'll go with added job.

19
00:01:25,700 --> 00:01:28,910
And again, keep in mind, this is false by default.

20
00:01:29,420 --> 00:01:33,350
All the way here in the bottom will invoke create job.

21
00:01:33,680 --> 00:01:38,930
So have two checks, one for empty values, which we will comment out right away just so we can test

22
00:01:38,930 --> 00:01:40,970
the error responses from the server.

23
00:01:41,330 --> 00:01:47,050
And we'll also check for is editing, which at the moment is false, but eventually we'll invoke at

24
00:01:47,120 --> 00:01:48,190
a job as well.

25
00:01:49,040 --> 00:01:54,020
And then as far as the functionality, well, that's how create job function and right from the get

26
00:01:54,020 --> 00:01:56,180
go will dispatch create jobs again.

27
00:01:56,450 --> 00:01:58,610
And you probably already know what we're going to do.

28
00:01:59,030 --> 00:02:04,070
We'll set up the loading one, then we'll grab these values from the state.

29
00:02:04,610 --> 00:02:10,190
So position company and everything that is required and will pass it in.

30
00:02:10,520 --> 00:02:14,180
So go off edge, but notice how we're not looking for response.

31
00:02:14,510 --> 00:02:15,250
So that's the thing.

32
00:02:15,530 --> 00:02:21,020
When we create the job, it's not like I'll display the job that I created.

33
00:02:21,350 --> 00:02:24,500
We have a separate page where I'm fetching all the jobs anyway.

34
00:02:24,860 --> 00:02:28,790
So once we add the job, I mean, I'm not really looking for a sponsor on the front.

35
00:02:29,390 --> 00:02:31,370
I just want to see whether everything worked.

36
00:02:31,820 --> 00:02:38,720
Meaning in here, I'll just go, wait, and then I'll dispatch to create job success, which in turn

37
00:02:38,990 --> 00:02:42,830
will set up that alert with the success message.

38
00:02:42,860 --> 00:02:43,280
That's it.

39
00:02:43,550 --> 00:02:46,190
Then we want to clear the values and we have multiple options.

40
00:02:46,190 --> 00:02:50,420
You can either go with clear values, function or in this case, I'm just going to go with dispatch.

41
00:02:50,870 --> 00:02:53,290
And then again, we have a error one.

42
00:02:53,300 --> 00:02:58,280
And in this case, I'll show you alternative approach, where essentially if the status one is for a

43
00:02:58,280 --> 00:02:59,960
one, we just return.

44
00:03:00,560 --> 00:03:07,100
And if it's not worth one than we dispatch the error, for example, please provide home values, which

45
00:03:07,100 --> 00:03:08,360
would be a 401.

46
00:03:08,690 --> 00:03:11,750
And I'm not going to cover one more time to things.

47
00:03:11,750 --> 00:03:19,010
I'm not going to cover the fact that if we have 401 one since we're using Auth, remember we automatically

48
00:03:19,160 --> 00:03:21,380
log out the user that's number one.

49
00:03:21,380 --> 00:03:27,590
And second, the reason why we go here with the return is simply because I don't want that alert hanging

50
00:03:27,590 --> 00:03:30,320
around since we are removing it in 30 seconds.

51
00:03:30,350 --> 00:03:34,610
Again, that's something we covered, so I really don't want to repeat myself.

52
00:03:34,880 --> 00:03:35,840
Let's keep on scrolling.

53
00:03:35,840 --> 00:03:40,130
And then as far as the reducer, like I said, when we create job is loading.

54
00:03:40,130 --> 00:03:46,640
It's true that if everything is correct, I really don't need to update much interstate, simply want

55
00:03:46,640 --> 00:03:47,990
to go alert type success.

56
00:03:48,260 --> 00:03:50,690
And yes, of course, loading and show alert.

57
00:03:51,020 --> 00:03:55,760
And as far as the text, well, it's going to be new job creator that's up to you or whatever you want

58
00:03:55,760 --> 00:03:57,440
to set up as far as the value.

59
00:03:57,830 --> 00:03:58,850
And what about the error?

60
00:03:59,120 --> 00:04:01,010
Well, this should definitely be familiar.

61
00:04:01,310 --> 00:04:07,670
We just said is loading false than we want to show the alert and then danger and then whatever message

62
00:04:07,670 --> 00:04:09,700
we're getting back from the server.

