// import qs from 'qs';
import request from './api';
// import { async } from 'q';

export const check = async (params) => {
  return request({
    url: `/campaign/questionnaire/check`,
    params,
    // 需要在headers设置token
    // withCredentials: true,
    headers: {
      token: params.token
    }
  })
}

export const checkLogin = async (params) => {
  return request({
    url: 'campaign/questionnaire/loginAuth',
    params,
    // 需要在headers设置token
    // withCredentials: true,
    // headers: {
    //   token: params.token
    // }
  })
}

export const questions = async (params) => {
   let h = params.setEntry ? { token: params.token} : {}
  return request({
    url: `campaign/questionnaire/questions`,
    params,
    // withCredentials: true
    headers: h
  })
}

export const postQuestion = async (params) => {
  return request({
    url: `campaign/questionnaire/apply`,
    method: 'post',
    data: params,
    // withCredentials: true
    headers: {
          token: params.token
        }
  })
}