diff --git a/src/app/(events)/eventData/page.tsx b/src/app/(events)/eventData/page.tsx new file mode 100644 index 0000000..18743dd --- /dev/null +++ b/src/app/(events)/eventData/page.tsx @@ -0,0 +1,41 @@ +// pages/index.tsx +"use client"; +import { useEffect } from "react"; + +// interface MeetupData { +// // Define the structure of your Meetup data here +// // Example: name: string; +// } + +export default function FetchDataPage() { + // const [data, setData] = useState(null); + + useEffect(() => { + const fetchData = async () => { + try { + const response = await fetch("/api/events/mockData", { + method: "POST", + }); + + if (response.ok) { + console.log('response', response) + console.log('response', response.json()) + // const result = await response.json(); + // setData(result); + } else { + console.error("Error:", response.statusText); + } + } catch (error) { + console.error("Error:", error); + } + }; + + void fetchData(); + }, []); + + return ( +
+

Meetup Data

+
+ ); +} diff --git a/src/app/api/events/mockData/route.ts b/src/app/api/events/mockData/route.ts new file mode 100644 index 0000000..59bd21c --- /dev/null +++ b/src/app/api/events/mockData/route.ts @@ -0,0 +1,36 @@ + + +export async function POST() { + const res = await fetch("https://www.meetup.com/gql2", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + operationName: "recommendedEventsWithSeries", + variables: { + first: 200, + lat: 49.279998779296875, + lon: -123.04000091552734, + topicCategoryId: "546", + startDateRange: "2023-11-23T17:20:15-05:00[US/Eastern]", + sortField: "DATETIME", + doConsolidateEvents: false, + after: + "Y21WalUyOTFjbU5sT25KaGJtdGxaQzFsZG1WdWRITXRZbmt0ZEdsdFpTeHBibVJsZURveU1BPT0=", + }, + extensions: { + persistedQuery: { + version: 1, + sha256Hash: + "0dd88409952899c04bb45c32890ba7383d5ae2ba6c9bdfd4ea2cffee77bbdf12", + }, + }, + }), + }); + + // const data = await res.json(); + // console.log("data", data); + + // return Response.json(data); +}