From fe8aec6070f0359fa30582ef40b692d024f39dc2 Mon Sep 17 00:00:00 2001 From: Jordi Enric <37541088+jordienr@users.noreply.github.com> Date: Tue, 23 Jul 2024 12:57:17 +0200 Subject: [PATCH] Redirect to API report when there are 0 reports (#28145) * redirect to api report when there are 0 reports * Update apps/studio/pages/project/[ref]/reports/index.tsx Co-authored-by: Alaister Young --------- Co-authored-by: Alaister Young --- apps/studio/pages/project/[ref]/reports/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/studio/pages/project/[ref]/reports/index.tsx b/apps/studio/pages/project/[ref]/reports/index.tsx index f21553199bb..81e08b532af 100644 --- a/apps/studio/pages/project/[ref]/reports/index.tsx +++ b/apps/studio/pages/project/[ref]/reports/index.tsx @@ -24,7 +24,8 @@ export const UserReportPage: NextPageWithLayout = () => { const reports = data.content .filter((x) => x.type === 'report') .sort((a, b) => a.name.localeCompare(b.name)) - if (reports.length > 1) router.push(`/project/${ref}/reports/${reports[0].id}`) + if (reports.length >= 1) router.push(`/project/${ref}/reports/${reports[0].id}`) + if (reports.length === 0) router.push(`/project/${ref}/reports/api-overview`) }, })