There are currently circumstances that you get a 500 error instead, but we want to always show an unauthorized message.
If the user isn't signed in, we definitely need to display an unauthorized screen. We have this code for that:
{!session && !loading && (
<UnauthorizedCard />
)}
In the case that a fetch fails in getInitialProps, we need to always pass along an error message to the page—and getInitialProps should immediately stop trying to do further fetching. Then, we want to display that error message, and make sure that if the main data we use is undefined, that code using it doesn't try to be run.
There are currently circumstances that you get a 500 error instead, but we want to always show an unauthorized message.
If the user isn't signed in, we definitely need to display an unauthorized screen. We have this code for that:
In the case that a fetch fails in
getInitialProps, we need to always pass along an error message to the page—andgetInitialPropsshould immediately stop trying to do further fetching. Then, we want to display that error message, and make sure that if the main data we use is undefined, that code using it doesn't try to be run.