// @ts-ignore
/* eslint-disable */
import {request} from 'umi';

export async function detail(paperId: number, secret: string) {
  if (secret) {
    return request<API.Response<API.Paper>>('/api/v1/paper/anonymousDetail', {
      method: 'POST',
      data: {paperId, secret: secret},
      skipErrorHandler: true
    });
  } else {
    return request<API.Response<API.Paper>>('/api/v1/paper/detail', {
      method: 'POST',
      data: {paperId, secret: secret},
      skipErrorHandler: true
    });
  }
}


export async function answer(param: API.SubmitAnswerParam) {
  if (param.secret) {
    return request<API.Response<API.Paper>>('/api/v1/paper/anonymousSubmit', {
      method: 'POST',
      data: param,
      requestType: 'json',
      skipErrorHandler: true
    });
  } else {
    return request<API.Response<API.Paper>>('/api/v1/paper/submit', {
      method: 'POST',
      data: param,
      requestType: 'json',
      skipErrorHandler: true
    });
  }

}


