Moved Dispatch NAvbar component, to remove code dupl.; Fixed timezone bug in hub
This commit is contained in:
@@ -5,13 +5,14 @@ import { getServerSession } from "../../auth/[...nextauth]/auth";
|
||||
// DELETE /api/booking/[id] - Delete a booking
|
||||
export const DELETE = async (req: NextRequest, { params }: { params: { id: string } }) => {
|
||||
try {
|
||||
console.log(params);
|
||||
const session = await getServerSession();
|
||||
if (!session?.user) {
|
||||
return NextResponse.json({ error: "Not authenticated" }, { status: 401 });
|
||||
}
|
||||
|
||||
const bookingId = params.id;
|
||||
const bookingId = (await params).id;
|
||||
|
||||
console.log("Attempting to delete booking with ID:", bookingId);
|
||||
|
||||
// Find the booking
|
||||
const booking = await prisma.booking.findUnique({
|
||||
@@ -40,14 +41,14 @@ export const DELETE = async (req: NextRequest, { params }: { params: { id: strin
|
||||
};
|
||||
|
||||
// PUT /api/booking/[id] - Update a booking
|
||||
export const PUT = async (req: NextRequest, { params }: { params: { id: string } }) => {
|
||||
export const PATCH = async (req: NextRequest, { params }: { params: { id: string } }) => {
|
||||
try {
|
||||
const session = await getServerSession();
|
||||
if (!session?.user) {
|
||||
return NextResponse.json({ error: "Not authenticated" }, { status: 401 });
|
||||
}
|
||||
|
||||
const bookingId = params.id;
|
||||
const bookingId = (await params).id;
|
||||
const body = await req.json();
|
||||
const { type, stationId, startTime, endTime } = body;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user