fix : job
deskripsi: - page: job-vacancy untuk non user sudah bisa di akses kembali - tidak menggunakan use server lagi melainkan API
This commit is contained in:
25
src/app/api/not-user/job/[id]/route.ts
Normal file
25
src/app/api/not-user/job/[id]/route.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import prisma from "@/lib/prisma";
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
{ params }: { params: { id: string } }
|
||||
) {
|
||||
try {
|
||||
const { id } = params;
|
||||
|
||||
const data = await prisma.job.findUnique({
|
||||
where: {
|
||||
id: id,
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json(data);
|
||||
} catch (error) {
|
||||
console.error("Error fetching job data:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "Failed to fetch job data" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user