{"size": 843, "ext": "js", "max_stars_repo_path": "src/services/user.service.js", "max_stars_repo_name": "InstitutionManagement/Frontend", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/services/user.service.js", "max_issues_repo_name": "InstitutionManagement/Frontend", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/services/user.service.js", "max_forks_repo_name": "InstitutionManagement/Frontend", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.34375, "max_line_length": 86, "alphanum_fraction": 0.6773428233}
import http from './http.service';

const login = (username, password) => http.post('/api/login', { username, password });
// remove user from local storage to log user out
const logout = () => {
  localStorage.removeItem('user');
};

const getAll = () => http.get('/users');

const getById = id => http.get('/users/' + id);

// const superAdminRegister = (user) => http.post('/api/superadmin/register', user);

// const getAllSuperAdmins = () =>  http.post('/api/superadmin/getAllSuperAdmins');

const update = user => fetch('/users/update', user);

// prefixed const name with underscore because delete is a reserved word in javascript
const _delete = id => fetch.post('/users/delete', id);

export const userService = {
  login,
  logout,
  // superAdminRegister,
  // getAllSuperAdmins,
  getAll,
  getById,
  update,
  delete: _delete
};
