zesty-io / accounts-ui

Zesty.io account management application
https://accounts.zesty.io
105 stars 12 forks source link

fix: use private Route to guard LoadUser and AppWithRouter #212

Closed nibblebot closed 3 years ago

nibblebot commented 3 years ago

current behavior of <LoadUser> is dependent on undefined React Router behavior since it's not returning a <Route> as a child of <Switch>. this PR adds PrivateRoute wrapper that renders a <Route> wrapping the children if auth passes. In this way all the Switch children are Routes and we are back in safe territory with React Router API. As a side effect, it appears to fix the 2fa login bug. fixes #204