Instructor: At the end of the last section,
I was unable to get an error message to show up
when I tried to sign in or sign up
with a email that's already been in use.
So it turns out
I simply had not refreshed my browser properly.
If I click on sign up again,
you'll notice that I am in fact
seeing the error message appear.
So that's very good.
Now that our user has the ability to sign up
to our application,
we need to make sure that after they successfully sign up
for a new account,
we try to redirect them over to the feature route.
Remember, the feature route is supposed to be protected
from users who are not signed into our application.
So, let's figure out how to do this.
To make sure that a user
is able to get automatically redirected over,
we're gonna find our signup component,
here it is right here,
and inside the onSubmit Handler
where we are calling our signup Action creator,
We are gonna pass a callback to this thing.
So as a second argument to the signup action creator,
I'm gonna pass in a callback
that will be automatically called
after user successfully signs up.
Inside this callback function
I'm going to do that navigation step
that will send a user over to that feature route.
So inside of here, to automatically redirect our user,
we're going to get that props object
or that history prop that we get provided by Redux Router.
We'll say this.props.history.push
and we're gonna send them over to the feature route.
Then we'll flip back over to our signup action creator.
So here's my signup action creator.
I'm gonna make sure that I record,
that we get a second prop in here
and I will call it, callback, like so.
So then inside of my try statement
after we get back response
and after we dispatch an action
saying that the user is now signed in,
I will call that callback.
So when we try to call the callback
that's going to make sure
that our user gets automatically redirected.
So I'll save this file
and we'll test this out again inside the browser.
Back inside my browser,
I'll let the refresh kick in.
I'll then go to my signup route and I'll create a new login.
So for this one, we don't really need anything,
I'll just put in gibberish, and now when I click on signup,
I get automatically redirected over to the feature route.
Awesome, okay, so that's another step forward.
Let's continue in the next section.