Skip to content
Discussion options

You must be logged in to vote

@itzAymvn I don't know why exactly, but in my case it wouldn't redirect because at the time redirecting, router was not aware of user being successfully authenticated, so I had to refresh the state manually

router.refresh()

and then

router.replace('route-to-redirect')

So in your case it would be

    console.log("Before redirect");
    router.refresh(); // dirty fix, but it works
    router.push("/dashboard");
    console.log("After redirect");

CC @icyJoseph

Replies: 9 comments 27 replies

Comment options

You must be logged in to vote
1 reply
@itzAymvn
Comment options

Comment options

You must be logged in to vote
9 replies
@itzAymvn
Comment options

@icyJoseph
Comment options

@itzAymvn
Comment options

@itzAymvn
Comment options

@bartekczyz
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
12 replies
@jamesopti
Comment options

@bartekczyz
Comment options

@Manmit124
Comment options

@CaioMS2000
Comment options

@na-zi-ya
Comment options

Answer selected by itzAymvn
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Reynalroddy
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@stephenscript
Comment options

@argonathmos
Comment options

Comment options

You must be logged in to vote
2 replies
@Coudercf
Comment options

@SergeySharipov
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet