import { request } from 'umi';
import type { NewsListParams, QADraftParams } from './data';
import service from '@/services/http/service';


export async function queryQADraftItem(id: number) {

  console.log("queryQADraftItem: ", id)
  let result = await service.post('/api/v1/qa/draft/list', {
    id,
    all: true,
    // order_asc: false,
    // tag: params.tag,
    // is_deleted: params.is_deleted,
    "page_no": 0,
    "page_size": 100
  });

  return Promise.resolve({
    data: result.data.list,
    success: true,
  })
}


// 保存草稿箱
export async function editQADraftItem(params: QADraftParams) {

  console.log("editQADraftItem: ", params)
  let result = await service.post('/api/v1/qa/draft/edit', {
    ...params
  });

  return Promise.resolve({
    data: result.data.list,
    success: true,
  })
}







export async function newsQADraftPublish(id: number) {

  console.log("newsQADraftPublish: ", id)
  let result = await service.post('/api/v1/qa/draft/publish', {
    id: id
  });

  return Promise.resolve({
    data: result.data,
    success: true,
  })
}




