import request from '@/utils/request'

export function loginByUsername(username, password) {
  let authStr = window.btoa(
    `user=${username}@quantgroup.cn&password=${password}`
  )
  authStr = encodeURIComponent(authStr)
  return request({
    url: '/user/login',
    method: 'post',
    data: { auth: authStr }
  })
}

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

export function getUserInfo(token) {
  return request({
    url: '/user/check_token_new',
    method: 'get',
    params: { token }
  })
}
