From 72bceec62df73b7b3c66206528282cecb599e100 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Fri, 4 Oct 2024 15:16:01 -0600 Subject: [PATCH] refactor: add try catch --- apps/dokploy/pages/index.tsx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/apps/dokploy/pages/index.tsx b/apps/dokploy/pages/index.tsx index 50bdc29a..d830895c 100644 --- a/apps/dokploy/pages/index.tsx +++ b/apps/dokploy/pages/index.tsx @@ -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: {}, };