refactor: add try catch

This commit is contained in:
Mauricio Siu
2024-10-04 15:16:01 -06:00
parent 3d32314e80
commit 72bceec62d

View File

@@ -198,16 +198,19 @@ Home.getLayout = (page: ReactElement) => {
};
export async function getServerSideProps(context: GetServerSidePropsContext) {
if (IS_CLOUD) {
const { user } = await validateRequest(context.req, context.res);
try {
const { user } = await validateRequest(context.req, context.res);
if (user) {
return {
redirect: {
permanent: true,
destination: "/dashboard/projects",
},
};
}
} catch (error) {}
if (user) {
return {
redirect: {
permanent: true,
destination: "/dashboard/projects",
},
};
}
return {
props: {},
};