1
00:00:00,210 --> 00:00:00,630
Beautiful.

2
00:00:00,960 --> 00:00:06,790
And once we have the functionality on the back end now, let's also implement everything on the front

3
00:00:06,790 --> 00:00:06,990
then.

4
00:00:07,530 --> 00:00:12,960
And my apologies if this video is longer than the usual ones.

5
00:00:13,830 --> 00:00:19,320
But the thing is, we already have pretty much covered most of the stuff in the previous pages.

6
00:00:19,620 --> 00:00:20,880
More specifically, register.

7
00:00:21,180 --> 00:00:25,200
So I kind of feel that there is no point on splitting this up.

8
00:00:25,950 --> 00:00:27,480
And basically, here's what we want to do.

9
00:00:28,020 --> 00:00:31,410
We want to set up a form with a profile.

10
00:00:31,920 --> 00:00:33,830
And here we have four fields.

11
00:00:33,990 --> 00:00:36,720
So name, last name, email and location.

12
00:00:37,110 --> 00:00:44,820
Now what we need to understand is that by default, I want to set them up to whatever I have in the

13
00:00:44,820 --> 00:00:45,300
user.

14
00:00:45,660 --> 00:00:49,980
So the one that I'm getting with my initial request, where is it located?

15
00:00:50,310 --> 00:00:53,460
It is located in the state or here.

16
00:00:53,760 --> 00:00:54,810
Keep on scrolling notice.

17
00:00:54,810 --> 00:01:01,500
We have the user object and here I have email, last name, location and name, and I will set this

18
00:01:01,500 --> 00:01:03,270
up as a local state.

19
00:01:03,510 --> 00:01:09,000
In this page, and I'll just use my user object for my default values.

20
00:01:09,420 --> 00:01:10,620
So these are my default ones.

21
00:01:10,950 --> 00:01:16,710
And then if I want to make some changes, I just fill out the fields and then we'll make a request just

22
00:01:16,710 --> 00:01:19,350
like we did in the postman in the previous one.

23
00:01:20,130 --> 00:01:25,240
And then if everything is correct, we update the values get new token and life is great.

24
00:01:25,260 --> 00:01:31,290
Now, if one of ours is missing, I guess that we'll check in both places, so check on a frontend as

25
00:01:31,290 --> 00:01:34,230
well as the server for the empty values.

26
00:01:34,560 --> 00:01:36,120
Hopefully this makes sense.

27
00:01:36,120 --> 00:01:40,320
And then eventually we'll use of this location when we're adding the job.

28
00:01:40,890 --> 00:01:47,430
So again, that will be our default location when we add job to our database.

29
00:01:47,910 --> 00:01:50,670
So let's go back to our project.

30
00:01:51,000 --> 00:01:52,290
I'll close everything.

31
00:01:52,530 --> 00:01:55,980
I'll open up to read me since I'll showcase what we need to do.

32
00:01:56,310 --> 00:02:00,510
And the first thing in the app context, let's just set up a dummy function.

33
00:02:01,320 --> 00:02:02,190
I'm that user.

34
00:02:02,460 --> 00:02:04,770
This is world all passing the current user.

35
00:02:05,040 --> 00:02:08,190
So there's going to be an object with bunch of properties and all that.

36
00:02:08,550 --> 00:02:11,400
And then I just want to console.log the user.

37
00:02:11,750 --> 00:02:18,480
So and then we also want to go with the value and then pass it down to the rest of our application in

38
00:02:18,480 --> 00:02:19,980
our cash profile address.

39
00:02:20,160 --> 00:02:26,220
And before we take a look at the profile address, let's set this one up where we want to go to our

40
00:02:26,220 --> 00:02:29,820
client and source then app context.

41
00:02:30,240 --> 00:02:36,600
And let's say right after the log out user, I'm going to go with update and then user.

42
00:02:36,750 --> 00:02:37,950
Now it's going to be a cinch.

43
00:02:38,220 --> 00:02:39,930
There's going to be a request.

44
00:02:40,290 --> 00:02:46,500
We're going to go with current user and let's just go with log and then current user effectively in

45
00:02:46,500 --> 00:02:50,970
this video, we'll just log it if all the values are provided.

46
00:02:51,750 --> 00:02:58,950
So once we pass this down, meaning once we add here to a value as well, we want to navigate to profile,

47
00:02:59,370 --> 00:03:02,430
which is located here in the dashboard.

48
00:03:02,790 --> 00:03:04,260
So notice all of these pages.

49
00:03:04,530 --> 00:03:10,740
We're looking for a profile and look for use state because it is my preference.

50
00:03:10,740 --> 00:03:18,480
If I can't set this up as a local state, there's really no need in this scenario to add anything to

51
00:03:18,480 --> 00:03:19,230
the global state.

52
00:03:19,800 --> 00:03:21,870
I mean, we just have to form values.

53
00:03:22,110 --> 00:03:24,840
We want to fill them out and then send the request.

54
00:03:25,590 --> 00:03:27,240
Can you set it up as global?

55
00:03:27,270 --> 00:03:29,190
Yes, but I really don't see the point.

56
00:03:29,610 --> 00:03:34,860
And as far as the rest of the imports, I'm looking for form row because we don't have a form.

57
00:03:35,160 --> 00:03:38,100
I want to get the alert two components we already worked on.

58
00:03:38,350 --> 00:03:42,660
I want to get used up context, which is going to be equal, of course, to my app context.

59
00:03:43,140 --> 00:03:49,410
And then for this one, the wrapper you're looking for is dashboard form page.

60
00:03:49,740 --> 00:03:50,180
Why?

61
00:03:50,550 --> 00:03:53,700
Because will we use it over here as well?

62
00:03:54,030 --> 00:04:00,990
So essentially her to have one place for all the stars, one from the app context, I want to get user

63
00:04:01,410 --> 00:04:03,180
and then a rest of the functions.

64
00:04:03,180 --> 00:04:07,560
So color display update user and then he's loading as well.

65
00:04:07,830 --> 00:04:16,800
And then, like I said, I will have a local state where I'll check for the user and I'll use the properties

66
00:04:16,800 --> 00:04:17,490
as default.

67
00:04:17,850 --> 00:04:24,600
And since there might be some instances where users now notice, again, we have this optional chaining

68
00:04:24,930 --> 00:04:30,590
where I go with user and if the user exists, then I want to get the name and the same I have for email,

69
00:04:30,590 --> 00:04:32,010
last name and location.

70
00:04:32,310 --> 00:04:38,040
Now, as far as handles, submit will prevent a default, will check for empty values and then we'll

71
00:04:38,040 --> 00:04:38,940
display the alert.

72
00:04:39,390 --> 00:04:44,430
Now, while we're testing everything, basically we will be setting up the app request.

73
00:04:44,700 --> 00:04:48,570
Since I want to showcase the differences between the errors.

74
00:04:48,570 --> 00:04:54,780
We're getting back from the server and actually will come this one out because it's hard to showcase

75
00:04:55,290 --> 00:04:59,400
what would be the response from the server with empty values if I'm already checking.

76
00:04:59,930 --> 00:05:04,160
On a front then, so then removed temporary and then we'll add it back up.

77
00:05:04,430 --> 00:05:06,080
And here I have the update user.

78
00:05:06,470 --> 00:05:09,980
So if all the powers are provided, I'll pass here.

79
00:05:09,980 --> 00:05:14,620
This object, the current user, and then it now forms a form.

80
00:05:14,630 --> 00:05:20,890
We have here a little bit of styling, so form on cement equals to handle some high profile Charlotte,

81
00:05:20,900 --> 00:05:22,070
just like can register.

82
00:05:22,340 --> 00:05:24,350
And then we have a bunch of these form roles.

83
00:05:24,560 --> 00:05:29,780
And I guess the only difference in this case between the former is that we have in a register and the

84
00:05:29,780 --> 00:05:36,140
ones where we have in the profile meaning will set up in a proffer is the fact that since I don't have

85
00:05:36,140 --> 00:05:36,770
one object.

86
00:05:37,750 --> 00:05:41,230
In here, I have multiple use states.

87
00:05:41,680 --> 00:05:44,290
I'm just going to go with whatever is the function.

88
00:05:44,620 --> 00:05:45,040
I'm not.

89
00:05:45,040 --> 00:05:47,890
I'm looking for the event just like we did previously.

90
00:05:48,130 --> 00:05:54,080
Only the difference in the register, of course, is the fact that I was looking for it over here in

91
00:05:54,080 --> 00:05:58,180
the function and then there the acrobatics in a falling way.

92
00:05:58,420 --> 00:06:00,310
Now in the profile one.

93
00:06:00,660 --> 00:06:04,570
And my apologies, I was actually looking for a read me in profile.

94
00:06:04,570 --> 00:06:10,180
One will go set the name and then we need to go with our function because remember otherwise, it's

95
00:06:10,180 --> 00:06:16,120
going to get invoked right away since we're passing here the values and we'll grab around that target

96
00:06:16,120 --> 00:06:16,480
value.

97
00:06:16,780 --> 00:06:19,150
Again, there's many ways how you can set it up.

98
00:06:19,390 --> 00:06:25,510
I just wanted to showcase the other approach because now where you can implement it in your applications,

99
00:06:25,900 --> 00:06:28,540
when we have labeled text for the first time.

100
00:06:28,900 --> 00:06:33,700
Because now this year we're using name is equal to the last name because that's the state rather than

101
00:06:33,700 --> 00:06:35,170
all the work in the bottom.

102
00:06:35,180 --> 00:06:42,490
We have a button we type submit disabled as loading and equal to is loading and please wait and save

103
00:06:42,490 --> 00:06:42,940
changes.

