import { defAxios as request } from '@/utils/http'

export const login = (data) => {
  return request({
    url: '/auth/login',
    method: 'post',
    data
  })
}

export const refreshToken = () => {
  return request({
    url: '/auth/refreshToken',
    method: 'post'
  })
}

/**
 * @description: 获取menu和permission
 * @param {String} roleId 角色Id
 * @return {*}
 */
export const fetchPermission = (params) => {
  return request({
    url: `/permission/getRolePermission/`,
    method: 'GET',
    params
  })
}

/**
 * @description: 测试接口one
 * @return {*}
 */
export const permissionOne = () => {
  return request({
    url: 'permission/getOne',
    method: 'GET'
  })
}

/**
 * @description: 测试接口two
 * @return {*}
 */
export const permissionTwo = (id) => {
  return request({
    url: 'permission/getTwo',
    method: 'GET'
  })
}

export function getMenu() {
  return request({
    url: '/index/getMenuList',
    method: 'GET'
  })
}
