import http from '@/utils/http'
import { AppDispatch } from '..'
/**
 * 亲属信息-获取列表
 */
export const A3_APIgetList = (data: any, flag = false): any => {
  if (flag) return http.post('cms/kinship/pageList', data)
  else {
    return async (dispatch: AppDispatch) => {
      const res = await http.post('cms/kinship/pageList', data)
      if (res.code === 0) {
        const obj = {
          list: res.data.records,
          total: res.data.total
        }

        dispatch({ type: 'A3/getList', payload: obj })
      }
    }
  }
}

/**
 * 亲属信息-删除
 */
export const A3_APIdel = (id: number) => {
  return http.get(`cms/kinship/remove/${id}`)
}

/**
 * 亲属信息-新增
 */
export const A3_APIsave = (data: any) => {
  return http.post('cms/kinship/save', data)
}

/**
 * 亲属信息-获取详情
 */
export const A3_APIgetInfo = (id: number) => {
  return http.get(`cms/kinship/detail/${id}`)
}
