{"size": 1612, "ext": "js", "max_stars_repo_path": "client/src/api/users.js", "max_stars_repo_name": "Darkzarich/Smiler", "max_stars_repo_stars_event_min_datetime": "2019-09-19T15:54:00.000Z", "max_stars_repo_stars_event_max_datetime": "2020-07-22T18:34:22.000Z", "max_issues_repo_path": "client/src/api/users.js", "max_issues_repo_name": "Darkzarich/express-blog", "max_issues_repo_issues_event_min_datetime": "2019-09-19T15:53:57.000Z", "max_issues_repo_issues_event_max_datetime": "2020-07-30T10:27:51.000Z", "max_forks_repo_path": "client/src/api/users.js", "max_forks_repo_name": "Darkzarich/Smiler", "max_forks_repo_forks_event_min_datetime": "2020-02-02T16:06:51.000Z", "max_forks_repo_forks_event_max_datetime": "2020-02-02T16:06:51.000Z"}
{"max_stars_count": 3, "max_issues_count": 5, "max_forks_count": 1, "avg_line_length": 19.421686747, "max_line_length": 57, "alphanum_fraction": 0.5248138958}
import Query from './_query';

const CONTROLLER_URL = '/users';

export default {
  getUserProfile(login) {
    return Query({
      url: `${CONTROLLER_URL}/${login}`,
      method: 'get',
    });
  },
  checkAuthState() {
    return Query({
      url: `${CONTROLLER_URL}/get-auth`,
      method: 'get',
    });
  },
  updateUserProfile(login, data) {
    return Query({
      url: `${CONTROLLER_URL}/${login}`,
      method: 'put',
      data,
    });
  },
  removeFilePicSection(login, hash) {
    return Query({
      url: `${CONTROLLER_URL}/${login}/template/${hash}`,
      method: 'delete',
    });
  },
  getUserTemplate(login) {
    return Query({
      url: `${CONTROLLER_URL}/${login}/template`,
      method: 'get',
    });
  },
  updateUserTemplate(login, data) {
    return Query({
      url: `${CONTROLLER_URL}/${login}/template`,
      method: 'put',
      data,
    });
  },
  createUser(data) {
    return Query({
      url: CONTROLLER_URL,
      method: 'post',
      data,
    });
  },
  authUser(data) {
    return Query({
      url: `${CONTROLLER_URL}/auth`,
      method: 'post',
      data,
    });
  },
  logoutUser() {
    return Query({
      url: `${CONTROLLER_URL}/logout`,
      method: 'post',
    });
  },
  followUser(id) {
    return Query({
      url: `${CONTROLLER_URL}/${id}/follow`,
      method: 'put',
    });
  },
  unfollowUser(id) {
    return Query({
      url: `${CONTROLLER_URL}/${id}/follow`,
      method: 'delete',
    });
  },
  getUsersFollowing(login) {
    return Query({
      url: `${CONTROLLER_URL}/${login}/following`,
      method: 'get',
    });
  },
};
