apps/web: fix show statusCode error

This commit is contained in:
vchikalkin 2024-03-04 16:26:54 +03:00
parent 2ec2a14706
commit 540d5642a1
2 changed files with 9 additions and 5 deletions

View File

@ -11,13 +11,13 @@ import { dehydrate, QueryClient } from '@tanstack/react-query';
import Head from 'next/head';
export default function Home(props) {
if (props.statusCode !== 200) return <Error {...props} />;
hooks.useSentryScope();
hooks.useMainData();
hooks.useInsuranceData();
hooks.useReactions();
if (props.statusCode !== 200) return <Error {...props} />;
return (
<Grid>
<Head>
@ -61,7 +61,10 @@ export const makeGetServerSideProps = ({ roles }) =>
if (!systemuser?.roles?.some((x) => x?.name && roles.includes(x.name))) {
return {
props: { statusCode: 403 },
props: {
initialQueryState: dehydrate(queryClient),
statusCode: 403,
},
};
}
@ -77,6 +80,7 @@ export const makeGetServerSideProps = ({ roles }) =>
return {
props: {
error: JSON.stringify(error),
initialQueryState: dehydrate(queryClient),
statusCode: 500,
},
};

View File

@ -12,14 +12,14 @@ export default function Unlimited(props) {
const store = useStore();
store.$process.add('Unlimited');
if (props.statusCode !== 200) return <Error {...props} />;
hooks.useSentryScope();
hooks.useMainData();
hooks.useGetUsers();
hooks.useInsuranceData();
hooks.useReactions();
if (props.statusCode !== 200) return <Error {...props} />;
return (
<Grid>
<Head>