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'
  })
}

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

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