Current section: Protecting Routes 6 exercises

Redirect Functionality

Loading exercise


00:00 Let's say that I'm over here and I'm like I want to change my picture and I quick change and I decide okay Yeah, this is this is the picture I want I'm gonna go with the koala cuddle and then I like forget about it or something I've got another tab open and I'm like, yeah, okay. I've got a I got to be done. We're gonna log out

00:17 So then I come over here and I hit save photo and I go to login though. That's that's not fun Okay, we'll say Cody Cody loves you and now I forgot what was I doing do you remember okay?

00:31 I do remember but users sometimes like they don't remember and even if they do they don't have to go click and click and Where was it? Yep. Click. There you go. All of those steps. I don't have to do all that again So what we want to do is take the URL that the user is currently at so when we kick them over to the login we want to take that URL and

00:52 We want to Put that somewhere where we'll be able to send them back to where they were trying to go in the first place to the the Place that they were when we kicked them over to the login. This is actually a pretty common Thing you'll probably notice that sometimes when you are on a login screen They'll have a redirect to and then there will be some stuff in here

01:13 So where they want to to go back to so that's what you're going to be doing is implementing Support for redirect to so this should be implemented on the login Screen right here. We should also Like you can if you want to implement it on the sign-in screen as well

01:30 But the idea is you put it like a hidden input in here and then send that to the server and then instead of sending You back to the home screen. It will send you back to whatever the redirect to us pretty simple straightforward But it does require a little bit of smarts around our Autotils for logging the user out in this case

01:49 Because we want to make sure that the users experience in doing that is super stellar. And so that is your job is to to implement that bit that change in our utility and Add that to the login screen. Have a good time