{"size": 955, "ext": "js", "max_stars_repo_path": "src/api/login.js", "max_stars_repo_name": "herainyday/daemon-hunter", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/api/login.js", "max_issues_repo_name": "herainyday/daemon-hunter", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/api/login.js", "max_forks_repo_name": "herainyday/daemon-hunter", "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": 17.6851851852, "max_line_length": 60, "alphanum_fraction": 0.6104712042}
import request from '@/utils/request'

export function loginByUsername(username, password) {
  const data = {
    'username': username,
    'password': password
  }
  return request({
    url: '/api/v1.0/user/login',
    method: 'post',
    data
  })
}

export function logout() {
  return request({
    url: '/login/logout',
    method: 'post'
  })
}

export function getUserInfo(token) {
  return request({
    url: '/api/v1.0/user/info',
    method: 'post'
  })
}

export function resetPassword(oldPassword, newPassword) {
  const data = {
    'old': oldPassword,
    'new': newPassword
  }
  return request({
    url: '/api/v1.0/user/resetPassword',
    method: 'post',
    data
  })
}

export function register(username, password, email, phone) {
  const data = {
    'username': username,
    'password': password,
    'email': email,
    'phone': phone
  }
  return request({
    url: '/api/v1.0/user/register',
    method: 'post',
    data
  })
}
