WEBVTT

00:00.520 --> 00:01.840
Hi everyone.

00:01.840 --> 00:15.000
In this video I will show you how we can return in the best way using the concept of veto and use the

00:15.000 --> 00:15.880
interceptor.

00:16.160 --> 00:24.920
Okay, right here inside the RC folder I will create one more folder will be underscore cross.

00:25.040 --> 00:30.360
Okay, these are the cross for the new for the interceptor.

00:31.400 --> 00:35.320
And maybe in the future we will have a middleware okay.

00:35.360 --> 00:37.560
Or girls or something like that.

00:40.400 --> 00:40.960
Okay.

00:41.720 --> 00:47.280
The reason I put it inside the car because it will organize the code.

00:47.320 --> 00:47.600
Okay.

00:47.640 --> 00:56.200
And I want most many things right here outside the root folder or the src folder okay.

00:57.200 --> 01:03.910
It will be messy with the other module, so I will move that into the course.

01:04.790 --> 01:08.150
And right now let's go to the interceptor.

01:11.950 --> 01:15.110
So here let's create interceptor.

01:16.550 --> 01:30.270
We will jump from radio Interceptor and move over here and make sure we install the class transformer.

01:31.150 --> 01:31.750
Okay.

01:34.470 --> 01:36.990
Now let's see how we can install that.

01:37.550 --> 01:47.750
If you remember in the first section of the video on the core concept of the session, I already showed

01:47.790 --> 01:49.830
you the validation.

01:49.830 --> 01:50.830
That is right.

01:51.430 --> 01:54.990
In here we have a class validator and class transformer.

01:55.310 --> 01:56.670
For now let's install.

01:56.670 --> 01:57.420
That's does also.

02:01.540 --> 02:13.540
Now, if you do not understand what the god's over here, but please go back and watch the section about

02:14.900 --> 02:18.060
the legit fundamental.

02:19.100 --> 02:19.620
Okay.

02:22.700 --> 02:23.700
Now we have an error.

02:23.700 --> 02:24.340
Let me say.

02:28.140 --> 02:29.580
Right here we have.

02:31.820 --> 02:34.820
Error from S linked.

02:35.780 --> 02:37.140
Well two error.

02:38.340 --> 02:40.820
Firstly let me show you how we can fit us.

02:41.580 --> 02:46.180
Click here and click on show documentation and open that.

02:48.740 --> 02:52.300
In here let me copy the rule upstairs.

02:54.540 --> 02:58.570
And go to the eslint config.

02:59.370 --> 02:59.850
Okay.

03:00.970 --> 03:02.570
And start over here.

03:03.450 --> 03:05.850
And gentle off.

03:07.090 --> 03:15.770
It will fix one error and we have another error from the return.

03:15.770 --> 03:19.010
You can see you can read.

03:19.330 --> 03:25.450
Error will be no unsafe returns right.

03:26.130 --> 03:26.730
Right here.

03:26.730 --> 03:27.290
Let's change.

03:27.290 --> 03:34.250
The return will be off and this will be work.

03:38.010 --> 03:38.570
So.

03:41.250 --> 03:50.650
After we already have a transform right here, let me show you how it can be used inside this zero.

03:50.690 --> 03:59.120
Here of the authentication I will create a small authentication with your lost keys.

03:59.680 --> 04:00.200
Right.

04:02.320 --> 04:02.880
In here.

04:02.920 --> 04:03.760
What do we need to do?

04:03.800 --> 04:05.320
I will export a class.

04:05.640 --> 04:06.840
We will respond.

04:07.480 --> 04:08.800
How little?

04:10.040 --> 04:13.880
Right here I will expose name.

04:19.160 --> 04:19.760
Email.

04:21.720 --> 04:22.240
Okay.

04:22.240 --> 04:24.320
We only missed two.

04:27.480 --> 04:27.960
Pieces.

04:27.960 --> 04:28.320
Here.

04:29.320 --> 04:32.560
Um, let me remove everything.

04:33.000 --> 04:37.760
I just need to return the blacklist.

04:37.920 --> 04:38.560
This thing.

04:39.960 --> 04:42.200
Well, right now, let's do that.

04:43.080 --> 04:45.000
Use interceptor.

04:45.760 --> 04:46.400
We will.

04:53.950 --> 04:59.710
Let me say, what is the name we will import from this year over here?

05:04.630 --> 05:08.750
And most of babies born on this year.

05:09.550 --> 05:10.030
Okay.

05:17.470 --> 05:19.990
And we have an error.

05:40.510 --> 05:41.150
The reason?

05:41.150 --> 05:45.750
Because right here, we just need to move it over here.

05:50.580 --> 05:51.100
Okay.

05:58.380 --> 06:01.180
And let's say it were not.

06:05.900 --> 06:09.260
Now you can say it's already got the name and email.

06:09.860 --> 06:10.380
Okay.

06:11.300 --> 06:12.540
And one more thing.

06:12.540 --> 06:18.020
We should return, which is the message okay.

06:18.060 --> 06:21.220
And what it will return the message will be success.

06:21.380 --> 06:23.820
And after that the type of data.

06:24.340 --> 06:30.780
So in order to do that go back to the transform radio interceptor.

06:31.460 --> 06:33.100
Let me close this line.

06:35.660 --> 06:36.140
Okay.

06:44.460 --> 06:53.050
So let me say Here we would say success, right?

06:53.690 --> 06:57.730
And we put the data we plan to test.

07:01.410 --> 07:01.930
Okay.

07:02.890 --> 07:07.610
And now we have one more TypeScript error.

07:08.330 --> 07:09.850
Let this border also.

07:19.810 --> 07:20.330
Okay.

07:20.370 --> 07:22.090
This will fix.

07:24.890 --> 07:29.130
And let me show you over here.

07:30.450 --> 07:38.930
Create a new team and say okay, we already got the data message and data.

07:39.370 --> 07:40.210
Very good.

07:42.090 --> 07:43.930
So that's for the video.

07:44.610 --> 07:46.810
And I will see you in the next one.
