WEBVTT

00:00.840 --> 00:02.280
Hi everyone.

00:02.640 --> 00:12.000
In this video let's add the validation in the next JS.

00:13.360 --> 00:13.880
Okay.

00:14.480 --> 00:23.280
For example, inside the authentication right here when we sign up and when we sign, we need to add

00:23.280 --> 00:27.960
a little bit of validation into the video.

00:28.320 --> 00:28.800
Okay.

00:29.560 --> 00:36.520
First of all, inside the signup video we need to add a bit of validation.

00:36.960 --> 00:46.840
First of all right here we need to mask for example like firstly let me go to the validation bit from

00:46.840 --> 00:53.680
the list over here and make sure we install this package.

00:56.200 --> 01:01.200
And let's scroll down a little bit in order to enable Enabled validation.

01:01.560 --> 01:03.840
We need to use this line right here.

01:04.760 --> 01:05.520
Let me copy.

01:06.040 --> 01:07.000
Isn't mine.

01:07.040 --> 01:08.000
Not the.

01:08.000 --> 01:10.240
Yes, we will enable us.

01:15.960 --> 01:17.840
Okay, so you see this line?

01:17.880 --> 01:21.240
If not, it will not work in here.

01:22.240 --> 01:25.720
We can use some validation rule.

01:25.720 --> 01:28.320
For example, if mail.

01:31.520 --> 01:33.200
Is not empty.

01:33.200 --> 01:36.960
Is or is emails.

01:37.040 --> 01:37.560
Right?

01:39.640 --> 01:40.600
Let me do that.

01:40.600 --> 01:45.360
For example inside here I will use the is not empty.

01:46.520 --> 01:49.480
We will import not from class validator.

01:52.680 --> 02:00.000
Is email over and over here we is not apply also.

02:01.090 --> 02:02.090
now let's say.

02:04.450 --> 02:05.450
It's a missile.

02:06.490 --> 02:11.050
Furthermore, if I remove the name, you can say it will or not.

02:11.970 --> 02:21.050
If I say, well, we will log the message error and bad request error will be name should not be empty.

02:21.170 --> 02:22.730
Very very cool right?

02:23.930 --> 02:29.090
And for more detail you can always check out this thing.

02:36.010 --> 02:38.370
You can say you can read more about us.

02:40.810 --> 02:45.930
It will have something like here okay.

02:46.570 --> 02:53.090
It will also provides most of the validator.

02:53.330 --> 02:57.210
We can use that without need to customize.

03:02.810 --> 03:05.930
And of course we can customize the message.

03:06.450 --> 03:12.330
For example, right here both the object with the message okay.

03:14.930 --> 03:20.090
But right now I think the message right here, it will be very enough for both of case.

03:20.570 --> 03:23.690
I will not customize anything.

03:27.730 --> 03:33.650
And let me go to the side also we need the user is email.

03:41.490 --> 03:44.570
And is not.

03:46.970 --> 03:48.570
Empty okay.

03:51.890 --> 03:54.930
Furthermore if I put the invalid email.

03:59.500 --> 04:03.940
Let me say now you can say email me an email.

04:04.260 --> 04:04.820
Right.

04:09.340 --> 04:09.900
So.

04:15.140 --> 04:18.060
I think that will be enough.

04:18.780 --> 04:21.900
And we will ask one more thing.

04:22.860 --> 04:31.180
Is that the authentication service, when we sign up we want to make sure the email should be unique.

04:31.420 --> 04:31.940
Right.

04:35.940 --> 04:36.420
Okay.

04:37.380 --> 04:42.660
So right now let me show you how we can do that.

04:44.220 --> 04:49.740
I will just use my email gateway this dot.

04:52.540 --> 04:59.300
User module .5115 find my email?

04:59.580 --> 05:00.020
Okay.

05:00.060 --> 05:06.700
If we have a user by email, we will throw.

05:09.660 --> 05:12.380
New bug requests, etc..

05:16.060 --> 05:17.140
You may email.

05:19.860 --> 05:24.900
Already in use like does.

05:30.780 --> 05:31.660
Let me sign up.

05:37.820 --> 05:40.660
Now email already in use.

05:40.700 --> 05:41.460
Very good.

05:45.340 --> 05:49.420
So I think that will be enough for the validation.

05:50.220 --> 05:54.580
And for more detail please check out the documentation.

05:55.020 --> 05:58.740
Okay, I will see you in the next one.
