diff --git a/src/apiCalls.js b/src/apiCalls.js index 3c913e5..85df8c4 100644 --- a/src/apiCalls.js +++ b/src/apiCalls.js @@ -4,7 +4,9 @@ const getCookie = (name) => { if (parts.length === 2) return parts.pop().split(';').shift(); }; + export default async function fetchGameLink() { + const room_name = "Where's Bob?"; // Define the room_name variable as '1' // const res = await fetch('https://escapelink-be-42ffc95e6cf7.herokuapp.com/api/v0/games', { const res = await fetch('http://localhost:3000/api/v0/games', { method: 'POST', @@ -12,7 +14,8 @@ export default async function fetchGameLink() { headers: { 'Content-Type': 'application/json', 'X-CSRF-Token': getCookie('X-CSRF-Token') - } + }, + body: JSON.stringify({ room_name }), // Include the room_name in the request body }) if (!res.ok) { throw new Error( `${res.status}: Unable to retrieve link`)