react-check-auth icon indicating copy to clipboard operation
react-check-auth copied to clipboard

Redirect not work on browser refresh

Open sjoonk opened this issue 7 years ago • 4 comments

Very useful component, thank you.

In the Redirection example on the Readme Doc, https://github.com/hasura/react-check-auth#3-redirect-not-logged-in-users-to-login

If I just use Browser history router, it works well. But if I refresh the browser the example code not work, because #setState() methods called 3 times. First on initial rendering, second on toggleLoading(), and finally on fetchSuccess()/ Fail(). The UserInfo is null when initial rendering, so the example code trigger redirection to login url.

I think some other property is required that distinguish between initial rendering and the last rendering to solve this problem.

Thanks.

sjoonk avatar Sep 05 '18 09:09 sjoonk

I have the same issue and I fixed it by creating a fork of the project and set the isLoading property default value to True.

tsonev7 avatar Sep 16 '18 14:09 tsonev7

I have them same problem with you guys, but with your solution when we use it production server, i need to do the same? @tsonev7

ducanh2110 avatar Oct 24 '18 17:10 ducanh2110

@tsonev7 Can you please do a pull request for this?

arzke avatar Nov 13 '18 10:11 arzke

@brundozer I can, but I am not sure if this is the expected behaviour :)

tsonev7 avatar Jan 03 '19 17:01 tsonev7