diff --git a/src/app/(main)/reports/ReportsPage.tsx b/src/app/(main)/reports/ReportsPage.tsx
index a76a6a47..5b031cfa 100644
--- a/src/app/(main)/reports/ReportsPage.tsx
+++ b/src/app/(main)/reports/ReportsPage.tsx
@@ -2,8 +2,11 @@
import { Metadata } from 'next';
import ReportsHeader from './ReportsHeader';
import ReportsDataTable from './ReportsDataTable';
+import { useTeamUrl } from 'components/hooks';
+
+export default function ReportsPage() {
+ const { teamId } = useTeamUrl();
-export default function ReportsPage({ teamId }: { teamId: string }) {
return (
<>
diff --git a/src/app/(main)/reports/page.tsx b/src/app/(main)/reports/page.tsx
index 4b495aca..ef4e56ad 100644
--- a/src/app/(main)/reports/page.tsx
+++ b/src/app/(main)/reports/page.tsx
@@ -1,8 +1,8 @@
import ReportsPage from './ReportsPage';
import { Metadata } from 'next';
-export default function ({ params: { teamId } }: { params: { teamId: string } }) {
- return ;
+export default function () {
+ return ;
}
export const metadata: Metadata = {
diff --git a/src/pages/api/reports/index.ts b/src/pages/api/reports/index.ts
index 186a1821..f9d4cca4 100644
--- a/src/pages/api/reports/index.ts
+++ b/src/pages/api/reports/index.ts
@@ -66,11 +66,29 @@ export default async (
const data = await getReports(
{
where: {
- userId: !teamId && !websiteId ? userId : undefined,
- websiteId,
- website: {
- teamId,
- },
+ OR: [
+ ...(websiteId ? [{ websiteId }] : []),
+ ...(teamId
+ ? [
+ {
+ website: {
+ deletedAt: null,
+ teamId,
+ },
+ },
+ ]
+ : []),
+ ...(userId
+ ? [
+ {
+ website: {
+ deletedAt: null,
+ userId,
+ },
+ },
+ ]
+ : []),
+ ],
},
include: {
website: {