-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroute.ts
More file actions
22 lines (21 loc) · 855 Bytes
/
Copy pathroute.ts
File metadata and controls
22 lines (21 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { getServerSession } from 'next-auth/next';
import { NextRequest, NextResponse } from 'next/server';
import { authOptions } from './authConfig';
export const dynamic = "force-dynamic"
export async function GET(request: NextRequest) {
try {
const session = await getServerSession(authOptions);
const date = request.nextUrl.searchParams.get("bookingDate")
const response = await fetch(`${process.env.API_BASE_URL}/tour?plannedDate=${date}`, {
headers: {
'Content-Type': 'application/json',
'x-injected-oid': (session?.user as any).profile.oid,
}
});
const data = await response.json();
return NextResponse.json(data);
} catch (err) {
console.error(err);
return NextResponse.json({ message: err, success: false });
}
}