Curious as how to solve this.
API get call:
const res = await fetch( `${process.env.NEXT_PUBLIC_HADES_URL}/reservation/identity/${identityId}`, {
method: "GET",
cache: "no-cache",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer " + token,
}
})
if (!res.ok) throw new Error('Failed to fetch reservations')
console.log('msg res')
console.log(res)
return res.json()
}```
Page it is being called:
```'use client';
import {useSession} from "next-auth/react";
import getAllReservationsForIdentity from "@/lib/getAllReservationsForIdentity";
export default function ReservationsPage ({ params }: { params: { identityId: string, string }}) {
const { data: session } = useSession();
let reservationData: Reservation[] = [];
const getReservationsData = async () => {
reservationData = await getAllReservationsForIdentity(session?.user.identityId, session?.user.backendToken);
}
getReservationsData();
console.log(reservationData);
// const reservationsData: Promise<Reservation[]> = await getAllReservationsForIdentity(params.identityId);
return (
<h4>Hi</h4>
)
}