1
00:00:00,940 --> 00:00:09,510
In this video, we are going to redirect a user after registration to profile page or to any page.

2
00:00:09,520 --> 00:00:16,960
For the meantime, let's redirect the user to profile page so inside the controllers users and then

3
00:00:16,960 --> 00:00:18,460
the user controller.

4
00:00:18,640 --> 00:00:22,180
And this is where we are returning the response.

5
00:00:22,180 --> 00:00:29,050
Like I said, this one is for API development, meaning if you are returning back the data to the user

6
00:00:29,050 --> 00:00:35,350
and if you are using, for example, angular or React, you may need this data inside that.

7
00:00:35,350 --> 00:00:39,550
But for this we are going to return a HTML template.

8
00:00:40,030 --> 00:00:46,240
At this point, a user is being registered successfully so we can go ahead and then redirect.

9
00:00:46,240 --> 00:00:50,470
And that way I'm going to be pretty easy using a method on the response.

10
00:00:50,470 --> 00:00:52,390
So let me remove this one.

11
00:00:53,340 --> 00:00:56,760
And add comments by saying redirect.

12
00:00:57,330 --> 00:01:01,770
And it goes like this response dot redirect.

13
00:01:03,190 --> 00:01:08,990
And we passed in the past, meaning this path need to march to a route.

14
00:01:09,010 --> 00:01:16,680
So for this one, we want to go to API Virgin one users and then profile page.

15
00:01:16,690 --> 00:01:22,030
Remember, this one goes to the pro five page as we did from the client side.

16
00:01:22,030 --> 00:01:28,000
For this one, we are redirecting the user from the back end to the client side.

17
00:01:28,000 --> 00:01:29,860
So let's have a look.

18
00:01:31,010 --> 00:01:34,460
Now I'm going to register with different data.

19
00:01:35,460 --> 00:01:37,050
I would change this one to Ben.

20
00:01:37,050 --> 00:01:41,700
To Ben to and password any click register.

21
00:01:42,440 --> 00:01:47,990
And you can see that I was able to redirect it, but I couldn't find the actual path.

22
00:01:48,620 --> 00:01:52,400
So it's supposed to be API, but on my side.

23
00:01:52,760 --> 00:01:53,150
All right.

24
00:01:53,150 --> 00:01:56,510
So let me go ahead and register a new user.

25
00:01:56,510 --> 00:01:58,430
So you're going to be banned three.

26
00:01:59,160 --> 00:02:04,750
And you can see that it has been redirected me to my profile page.

27
00:02:04,770 --> 00:02:07,950
So what about in case we have an error?

28
00:02:07,980 --> 00:02:13,800
How are we going to display the error from the back end and place it into the page?

29
00:02:13,830 --> 00:02:17,010
Let's see how we're going to do that one in the next video.

