apps/web: create Content component to separate from error

This commit is contained in:
vchikalkin 2024-03-04 16:41:22 +03:00
parent 540d5642a1
commit 47d47a0bfd
2 changed files with 15 additions and 6 deletions

View File

@ -10,9 +10,7 @@ import * as hooks from '@/process/hooks';
import { dehydrate, QueryClient } from '@tanstack/react-query';
import Head from 'next/head';
export default function Home(props) {
if (props.statusCode !== 200) return <Error {...props} />;
function Content() {
hooks.useSentryScope();
hooks.useMainData();
hooks.useInsuranceData();
@ -29,6 +27,13 @@ export default function Home(props) {
</Grid>
);
}
export default function Home(props) {
if (props.statusCode !== 200) return <Error {...props} />;
return <Content />;
}
export const makeGetServerSideProps = ({ roles }) =>
/** @type {import('next').GetServerSideProps} */
(

View File

@ -8,12 +8,10 @@ import * as hooks from '@/process/hooks';
import { useStore } from '@/stores/hooks';
import Head from 'next/head';
export default function Unlimited(props) {
function Content() {
const store = useStore();
store.$process.add('Unlimited');
if (props.statusCode !== 200) return <Error {...props} />;
hooks.useSentryScope();
hooks.useMainData();
hooks.useGetUsers();
@ -33,6 +31,12 @@ export default function Unlimited(props) {
);
}
export default function Unlimited(props) {
if (props.statusCode !== 200) return <Error {...props} />;
return <Content />;
}
export const getServerSideProps = makeGetServerSideProps({
roles: unlimitedRoles,
});