var server = 'http://localhost:3000';

module.exports = {
  login: (username, password) => {
    return 
      fetch(server + '/login', {
        method: 'POST',
        headers: {
          'Accept': 'application/json',
          'Content-Type': 'application/json',
        },
        body: JSON.stringify({
          username: username,
          password: password
        })
      });
  },

  signup: (username, password, teacherOrStudent) => {
    return
      fetch(server + '/signup', {
        method: 'POST',
        headers: {
          'Accept': 'application/json',
          'Content-Type': 'application/json',
        },
        body: JSON.stringify({
          username: username,
          password: password,
          type: teacherOrStudent
        })
      });
  },

  getLessons: (classId) => {
    return fetch(server + '/teachers/lessons/' + classId);
  },

  getLessonData: (lessonId) => {
    return fetch(server + '/teachers/polls/' + lessonId);
  },

  startPoll: (pollObject, lessonId) => {
    console.log("start poll info::::::::::::")
    console.log(pollObject, lessonId);

    
      return fetch(server + '/teachers/polls', {
        method: 'POST',
        headers: {
          'Accept': 'application/json',
          'Content-Type': 'application/json',
        },
        body: JSON.stringify({
          pollObject: pollObject,
          lessonId: lessonId
        })
      }).then((resp) => {
        console.log("CATCH ME::::::::", resp);
      });
  }
}


var server = 'http://localhost:3000';

module.exports = {
  login: (username, password) => {
    return 
      fetch(server + '/login', {
        method: 'POST',
        headers: {
          'Accept': 'application/json',
          'Content-Type': 'application/json',
        },
        body: JSON.stringify({
          username: username,
          password: password
        })
      });
  },

  signup: (username, password, teacherOrStudent) => {
    return
      fetch(server + '/signup', {
        method: 'POST',
        headers: {
          'Accept': 'application/json',
          'Content-Type': 'application/json',
        },
        body: JSON.stringify({
          username: username,
          password: password,
          type: teacherOrStudent
        })
      });
  },

  getLessons: (classId) => {
    return fetch(server + '/teachers/lessons/' + classId);
  },

  getLessonData: (lessonId) => {
    return fetch(server + '/teachers/polls/' + lessonId);
  },

  startPoll: (pollObject, lessonId) => {
  
      return fetch(server + '/teachers/polls', {
        method: 'POST',
        headers: {
          'Accept': 'application/json',
          'Content-Type': 'application/json',
        },
        body: JSON.stringify({
          pollObject: pollObject,
          lessonId: lessonId
        })
      });
  }
}


Send promise from API request
Send promise from API request
