Connect, collaborate, and grow with a community of TypeScript developers
fix: access to user profile sections (#1091)
bautistaaa704a563826d5
diff --git a/apps/web/src/app/[locale]/[username]/bookmarks/page.tsx b/apps/web/src/app/[locale]/[username]/bookmarks/page.tsxindex c66e2460..a01bf0c6 100644--- a/apps/web/src/app/[locale]/[username]/bookmarks/page.tsx+++ b/apps/web/src/app/[locale]/[username]/bookmarks/page.tsx@@ -8,6 +8,7 @@ import {import { prisma } from '@repo/db';import { BookmarksTab } from '../_components/dashboard/bookmarks-tab';import { notFound } from 'next/navigation';+import { getServerAuthSession } from '@repo/auth/server';interface Props {params: {@@ -16,9 +17,10 @@ interface Props {}export default async function BookmarksPage({ params: { username: usernameFromQuery } }: Props) {+ const session = await getServerAuthSession();const [, username] = decodeURIComponent(usernameFromQuery).split('@');- if (!username) return notFound();+ if (!username || session?.user.name !== username) return notFound();const user = await prisma.user.findFirst({where: {diff --git a/apps/web/src/app/[locale]/[username]/completed/page.tsx b/apps/web/src/app/[locale]/[username]/completed/page.tsxindex 25c8b7d0..bf35d1bc 100644--- a/apps/web/src/app/[locale]/[username]/completed/page.tsx+++ b/apps/web/src/app/[locale]/[username]/completed/page.tsx@@ -8,6 +8,7 @@ import {import { CompletedTab } from '../_components/dashboard/completed-tab';import { notFound } from 'next/navigation';import { prisma } from '@repo/db';+import { getServerAuthSession } from '@repo/auth/server';interface Props {params: {@@ -16,9 +17,10 @@ interface Props {}export default async function CompletedPage({ params: { username: usernameFromQuery } }: Props) {+ const session = await getServerAuthSession();const [, username] = decodeURIComponent(usernameFromQuery).split('@');- if (!username) return notFound();+ if (!username || session?.user.name !== username) return notFound();const user = await prisma.user.findFirst({where: {diff --git a/apps/web/src/app/[locale]/[username]/in-progress/page.tsx b/apps/web/src/app/[locale]/[username]/in-progress/page.tsxindex b0fe4089..aafc9a5d 100644--- a/apps/web/src/app/[locale]/[username]/in-progress/page.tsx+++ b/apps/web/src/app/[locale]/[username]/in-progress/page.tsx@@ -8,6 +8,7 @@ import {import { InProgressTab } from '../_components/dashboard/in-progress-tab';import { notFound } from 'next/navigation';import { prisma } from '@repo/db';+import { getServerAuthSession } from '@repo/auth/server';interface Props {params: {@@ -16,9 +17,10 @@ interface Props {}export default async function InProgressPage({ params: { username: usernameFromQuery } }: Props) {+ const session = await getServerAuthSession();const [, username] = decodeURIComponent(usernameFromQuery).split('@');- if (!username) return notFound();+ if (!username || session?.user.name !== username) return notFound();const user = await prisma.user.findFirst({where: {