// 封装所有和用户相关的接口函数
import request from '@/utils/http'

export const getAuthCodeAPI = () => {
  return request({
    url: '/auth/code'
  })
}

export const loginAPI = (loginBody) => {
  return request({
    url: '/auth/passwordLogin',
    method: 'POST',
    headers: {
      isToken: false,
      isEncrypt: false
    },
    data: loginBody
  })
}

export const userInfoAPI = () => {
    return request({
    url: '/system/user/getInfo'
  })
}

export const getPublishAPI = () => {
  return request({
    url: '/web/scale/publish'
  })
}

export const addRecordAPI = (record)  => {
   return request({
    url: '/web/scale/record',
    method: 'POST',
    data: record
  })
}

export const addRecordIdAPI = (recordId)  => {
   return request({
    url: '/web/scale/record/' + recordId,
    method: 'POST'
  })
}

export const getAnswerAPI = (scaleId) => {
  return request({
    url: '/web/scale/answer/' + scaleId
  })
}

export const addAnswerAPI = (answer) => {
  return request({
    url: '/web/scale/record/answer',
    method: 'POST',
    data: answer
  })
}