import service from '../utils/request_axios';
function login_api(user_name, password) {
  return service({
    url: '/admin/users/login',
    method: 'POST',
    data: {
      loginName: user_name,
      loginPassword: password,
    },
  });
}

function menu_api(token) {
  return service({
    url: '/admin/module/list',
    method: 'GET',
  });
}

function login_out_api(token) {
  return service({
    url: '/admin/users/logout',
    method: 'GET',
  });
}

function user_info_api(data) {
  return service({
    url: '/admin/users/list',
    method: 'POST',
    data,
  });
}

function user_del_api(data) {
  return service({
    url: '/admin/users/delete/' + data,
    method: 'DELETE',
  });
}

function user_add_api(data) {
  return service({
    url: '/admin/users/add',
    method: 'POST',
    data,
  });
}

function user_role_api(data) {
  return service({
    url: '/admin/role/list',
    method: 'POST',
    data,
  });
}

function user_edit_api(data) {
  return service({
    url: '/admin/users/update',
    method: 'POST',
    data,
  });
}

function custom_list_api(data) {
    return service({
        url: '/admin/custom/list',
        method: 'POST',
        data,
    })
}

function custom_rule_api(data) {
    return service({
        url: '/admin/user-role/list',
        method: 'POST',
        data,
    })
}

export default {
  login_api,
  menu_api,
  login_out_api,
  user_info_api,
  user_del_api,
  user_add_api,
  user_role_api,
  user_edit_api,
  custom_list_api,
  custom_rule_api
};
