Redirection

Currently, I’m thinking about replacing this.context.router.push('/some/path') with some other lines. The idea is this. Before the page is loaded, it checks if current user is already logged in or not. If it is then please proceed to render the page normally and if not then please go to homepage.

The command for redirecting is either this.context.router.push or this.context.router.transitionTo. This depends on library version. Unfortunately, I found yesterday that push couldn’t be used anymore and neither could transition be. So, what should I do?

Apparently, you could put window.location = '/some/path' inside componentWillMount. But I wonder if that’s a good idea.

Advertisements

Author: anwari

stay low and keep your head down

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s