Skip to content

Persist authentication issue #1

@chaoming

Description

@chaoming

I implemented this into my application but it seems that the code to detect if currentUser exists

        !!currentUser ? (
          <RouteComponent {...routeProps} />
        ) : (
          <Redirect to={"/login"} />
        )

is executed before loading the currentUser

  useEffect(() => {
    app.auth().onAuthStateChanged(setCurrentUser);
  }, []);

so the result is the user will be redirected to login after refreshing the page.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions