import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/api/auth/login',
    method: 'post',
    data,
    isLoading: false
  })
}

export function getInfo(token) {
  return request({
    url: '/api/auth/me',
    method: 'post',
    params: { token },
    isLoading: false
  })
}

export function logout() {
  return request({
    url: '/api/auth/logout',
    method: 'post'
  })
}

export function permissions () {
  return request({
    url: `/api/auth/module-permissions/${window.MODULE_NAME||window.location.pathname.replaceAll(/\//g,"")||process.env.VUE_APP_MODULE_NAME}`,
    method: "get",
    isLoading: false,
    params: {
      module: window.MODULE_NAME||window.location.pathname.replaceAll(/\//g,"")||process.env.VUE_APP_MODULE_NAME
    }
  })
}
