rivernews / appl-tracky-spa

An Application Tracking System to help job finders ease their out-of-control spreadsheet use tracking every job application record.
https://appl-tracky.shaungc.com
1 stars 0 forks source link

Redirect user to to the page if user was trying to access an internal page #48

Closed rivernews closed 4 years ago

rivernews commented 4 years ago

Since we have session-persisten login state now, so it makes sense to start working on this.

Process flow

  1. User hit the app with an internal url: com-page/<com-id>
  2. Router (<page-route>) detects non-login state at first, so redirect to home page.
    • in private route container: !this.props.auth.isLogin && <Redirect to="/" />}
  3. At the App level, when it mounts, it requests login auth and takes a look into localStorage.
    • componentDidMount() RequestedLoginAuth()
  4. While staying at the home page, when login auth finishes (retrieve session login state), it brings user to home page (company list page).
    • this.props.auth.isLogin && <Redirect to="/home/" />}

A quick solution