Files
evidencija-rezija/app/api/locations/by-id/route.ts

13 lines
369 B
TypeScript

import { fetchLocationById } from '@/app/lib/actions/locationActions';
import { NextResponse } from 'next/server';
export const GET = async (
req: Request,
) => {
const url = new URL(req.url as string);
const locationId = url.searchParams.get('id');
const location = await fetchLocationById(locationId as string);
return NextResponse.json({ location });
}