{"size": 1966, "ext": "js", "max_stars_repo_path": "client/src/utils/API.js", "max_stars_repo_name": "sbharadw/continuous-education-tracker", "max_stars_repo_stars_event_min_datetime": "2021-09-03T09:15:57.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-03T09:15:57.000Z", "max_issues_repo_path": "client/src/utils/API.js", "max_issues_repo_name": "sbharadw/continuous-education-tracker", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "client/src/utils/API.js", "max_forks_repo_name": "sbharadw/continuous-education-tracker", "max_forks_repo_forks_event_min_datetime": "2021-04-29T22:36:55.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-30T00:12:57.000Z"}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": 3, "avg_line_length": 28.0857142857, "max_line_length": 77, "alphanum_fraction": 0.517293998}
import axios from "axios";

export default {

    /*------------------ User routes ----------------------------- */
                //references users model + userController

  // Gets all users
    getUsers: function() {
        return axios.get("/api/users");
    },
  // Gets the user with the given id
    getUser: function(id) {
      // console.log("STEP 2 ********************************")
      console.log(id)
        return axios.get("/api/users/" + id);
    },
    //Gets users by unit name
    getUsersByUnit: function(id) {
      // console.log("STEP 2 ###############################")
      console.log(id)
        return axios.get(`/api/users/unit/${id}`);
    },
  // Deletes the user with the given id
    deleteUser: function(id) {
        return axios.delete("/api/users/" + id);
    },
  // Saves a user to the database
    saveUser: function(userData) {
        return axios.post("/api/users", userData);
    },
  // Updates a user
    updateUser: function(id, userData){
      // console.log("STEP 2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
      // console.log(id)
      // console.log(userData)
      return axios.put("/api/users/" + id, userData);
    },

    updateUserHours: function(id, userData){
      console.log(id)
      console.log(userData)

      return axios.put("/api/users/eid/" + id, userData)
    },
  

    /*------------------ Course hours routes ----------------------------- */
                //references info model + infoController

  // Gets all Courses
    getCourses: function() {
        return axios.get("/api/info/");
    },
  // Gets the Course with the given id
    getCourse: function(id) {
        return axios.get("/api/info/" + id);
    },
  // Deletes the Course with the given id
    deleteCourse: function(id) {
        return axios.delete("/api/info/" + id);
    },
  // Saves a Course to the database
    saveCourse: function(userData) {
        return axios.post("/api/info", userData);
    }
    
};

