Best way for a private component #1063
Unanswered
YuriFontella
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
So far this has been the best solution I have been able to do.
I need something to protect the private components, I created a private layout that does the validation. And yes, it will always be necessary to pass the session.
And being on a private route without being logged in just showing an "access denied" message and something that bothers you. The user should be redirected and never be there.
_app.js
dashboard.js
private.js
I tried an approach with HOC and validating on getInitialProps, however, my pages are not static and I need getStaticProps or getServerSideProps.
(vercel/next.js#20883)
I accept tips or suggestions.
Or if this path is really valid.
Beta Was this translation helpful? Give feedback.
All reactions