6080-a3-BigBrain / frontend / src / BackendRequests / createGame.jsx
createGame.jsx
Raw
const createQuiz = async (token, name) => {
  const request = {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      Authorization: `Bearer ${token}`,
    },
    body: JSON.stringify(name),
  }
  console.log(request.body)
  const response = await fetch('http://localhost:5005/admin/quiz/new', request)
  if (response.status === 400) {
    console.log(await response.text());
  }
}

export default { createQuiz }