import { sldCommonService } from '@/utils/utils';

export default {
  namespace: 'helpArticle',
  state: {
    loading: false,//加载状态
    data: {
      list: [],
      pagination: {},
    },
  },

  effects: {
    //slodon_获取文章分类列表
    * get_article_cat_lists({ payload, callback }, { call }) {
      const response = yield call(sldCommonService, payload, 'get', 'v3/cms/admin/helpArticleCategory/list');
      if (callback) callback(response);
    },
    //slodon_添加文章分类
    * add_article_cat({ payload, callback }, { call }) {
      const response = yield call(sldCommonService, payload, 'post', 'v3/cms/admin/helpArticleCategory/add');
      if (callback) callback(response);
    },
    //slodon_编辑文章分类
    * edit_article_cat({ payload, callback }, { call }) {
      const response = yield call(sldCommonService, payload, 'post', 'v3/cms/admin/helpArticleCategory/edit');
      if (callback) callback(response);
    },
    //slodon_删除文章分类
    * del_article_cat({ payload, callback }, { call }) {
      const response = yield call(sldCommonService, payload, 'post', 'v3/cms/admin/helpArticleCategory/del');
      if (callback) callback(response);
    },
    //slodon_获取文章列表
    * get_article_lists({ payload, callback }, { call }) {
      const response = yield call(sldCommonService, payload, 'get', 'v3/cms/admin/helpArticle/list');
      if (callback) callback(response);
    },
    //slodon_添加文章
    * add_article({ payload, callback }, { call }) {
      const response = yield call(sldCommonService, payload, 'post', 'v3/cms/admin/helpArticle/add');
      if (callback) callback(response);
    },
    //slodon_编辑文章
    * edit_article({ payload, callback }, { call }) {
      const response = yield call(sldCommonService, payload, 'post', 'v3/cms/admin/helpArticle/edit');
      if (callback) callback(response);
    },
    //slodon_删除文章
    * del_article({ payload, callback }, { call }) {
      const response = yield call(sldCommonService, payload, 'post', 'v3/cms/admin/helpArticle/del');
      if (callback) callback(response);
    },
    //slodon_获取文章详情
    * get_article_detail({ payload, callback }, { call }) {
      const response = yield call(sldCommonService, payload, 'get', 'v3/cms/admin/helpArticle/detail');
      if (callback) callback(response);
    },
  },
};
