Skip to content

Commit 38d8e4a

Browse files
projects fixed api error
1 parent 2f8031a commit 38d8e4a

File tree

7 files changed

+895
-425
lines changed

7 files changed

+895
-425
lines changed

app/api/projects/[id]/route.ts

Lines changed: 0 additions & 137 deletions
This file was deleted.

app/api/projects/route.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@ import { createClient } from '@supabase/supabase-js'
22
import { NextRequest, NextResponse } from 'next/server'
33
import { z } from 'zod'
44

5-
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL!
6-
const supabaseServiceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY!
5+
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
6+
const supabaseServiceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY;
77

8+
if (!supabaseUrl) {
9+
throw new Error("CRITICAL: NEXT_PUBLIC_SUPABASE_URL environment variable is not defined.");
10+
}
11+
12+
if (!supabaseServiceRoleKey) {
13+
throw new Error("CRITICAL: SUPABASE_SERVICE_ROLE_KEY environment variable is not defined.");
14+
}
815
const supabase = createClient(supabaseUrl, supabaseServiceRoleKey)
916

1017
const createProjectSchema = z.object({
@@ -14,12 +21,6 @@ const createProjectSchema = z.object({
1421
template: z.string().optional(),
1522
})
1623

17-
const updateProjectSchema = z.object({
18-
name: z.string().min(1).max(50).optional(),
19-
description: z.string().max(200).optional(),
20-
visibility: z.enum(['private', 'public']).optional(),
21-
template: z.string().optional(),
22-
})
2324

2425
async function getUserFromAuth(request: NextRequest) {
2526
const authHeader = request.headers.get('authorization')

app/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,8 @@ export default function Home() {
349349
setHasMounted(true)
350350
}, [])
351351

352+
353+
352354
// Main form submission handler
353355
const handleSubmitAuth = useCallback(async (
354356
e: React.FormEvent<HTMLFormElement>,

0 commit comments

Comments
 (0)