Skip to content

Commit 63014f9

Browse files
authored
Merge pull request #239 from codeunia-dev/feature/core-team-application-form
feat: Add Core Team application form with authentication
2 parents d114ae7 + bb0f184 commit 63014f9

16 files changed

Lines changed: 2048 additions & 2 deletions

File tree

app/[username]/page.tsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { notFound } from 'next/navigation';
22
import { PublicProfileView } from "@/components/users/PublicProfileView";
33
import { reservedUsernameService } from '@/lib/services/reserved-usernames';
4+
import { createClient } from '@/lib/supabase/server';
45
import Header from "@/components/header";
56
import Footer from "@/components/footer";
67

@@ -26,8 +27,26 @@ export default async function UsernamePage({ params }: UsernamePageProps) {
2627
}
2728
}
2829

29-
// For now, treat all non-reserved usernames as profile routes
30-
// In the future, this could be expanded to handle other username-based routes
30+
// Check if the username actually exists in the database
31+
try {
32+
const supabase = await createClient();
33+
const { data: profile, error } = await supabase
34+
.from('profiles')
35+
.select('id, username, is_public')
36+
.eq('username', username)
37+
.eq('is_public', true)
38+
.single();
39+
40+
// If there's an error or no profile found, show 404
41+
if (error || !profile) {
42+
notFound();
43+
}
44+
} catch (error) {
45+
// If there's any error, show 404
46+
notFound();
47+
}
48+
49+
// If we get here, the username exists and is public
3150
return (
3251
<>
3352
<Header />

0 commit comments

Comments
 (0)