Skip to content

Commit

Permalink
Chore: changes game and room_id to room_name for initial game creation
Browse files Browse the repository at this point in the history
  • Loading branch information
MWoodshop committed Oct 20, 2023
1 parent f887aaf commit f7fdb43
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/apiCalls.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ 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',
credentials: 'include',
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`)
Expand Down

0 comments on commit f7fdb43

Please sign in to comment.