Skip to content

Commit

Permalink
fixed last endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ctgchris committed Apr 1, 2024
1 parent efcb0ee commit 030f25a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/app/api/responses/[responseId]/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ import { NextRequest, NextResponse } from 'next/server';
import { getResponseByID } from '../../../../lib/firebase/database/response';
import { Response } from '../../../../types/survey-types';

export async function GET(req: NextRequest) {
const urlParts = req.url.split('/');
const responseId: string = urlParts[urlParts.length - 1];

export async function GET(req: NextRequest, { params }: { params: { responseId: string } }) {
const { responseId } = params;
console.log('responseId:', responseId);
console.log('urlParts:', urlParts);

try {
const response: Response | null = await getResponseByID(responseId);
Expand All @@ -21,3 +18,4 @@ export async function GET(req: NextRequest) {
return NextResponse.json({ message: 'Internal Server Error' }, { status: 500 });
}
}

0 comments on commit 030f25a

Please sign in to comment.