import axios from '@/libs/api.request'
import config from '@/config'

const systemPrefix = config.deploymentStandAlone?'':'cas/'

const prefix = systemPrefix+'api/v1/base/commonLoginLandConfig'

/**
 * 分页查询方法
 * @param params
 * @returns {*|void|ClientRequest|ClientHttp2Stream|never|AxiosPromise<any>}
 */
export const getCommonLoginLandConfigPage = params => {
  return axios.request({
    url: prefix+'/page',
    params:params,
    method: 'get'
  })
}

/**
 * 根据参数查询列表
 * @param params
 * @returns {*|void|ClientRequest|ClientHttp2Stream|never|AxiosPromise<any>}
 */
export const getCommonLoginLandConfigList = params => {
  return axios.request({
    url: prefix+'/list',
    params:params,
    method: 'get'
  })
}

/**
 * 新增
 * @param params
 * @returns {Promise<any>}
 */
export const addCommonLoginLandConfig = (params) => {
  return new Promise((resolve, reject) => {
    axios.request({
      url: prefix+'/add',
      method: 'POST',
      data: params,
    }).then(response => {
      resolve(response.data);
    }).catch(err => {
      reject(err)
    })
  })
}

/**
 * 修改
 * @param params
 * @returns {Promise<any>}
 */
export const editCommonLoginLandConfig = (params) => {
  return new Promise((resolve, reject) => {
    axios.request({
      url: prefix+'/merge',
      method: 'POST',
      data: params,
    }).then(response => {
      resolve(response.data);
    }).catch(err => {
      reject(err)
    })
  })
}

/**
 * 删除
 * @param id
 * @returns {Promise<any>}
 */
export const deleteCommonLoginLandConfig = (id) => {
  return new Promise((resolve, reject) => {
    axios.request({
      url: prefix+'/delete/'+id,
      method: 'POST',
    }).then(response => {
      resolve(response.data);
    }).catch(err => {
      reject(err)
    })
  })
}




