/*
 * @Author: your name
 * @Date: 2022-03-04 14:46:13
 * @LastEditTime: 2022-03-04 14:47:47
 * @LastEditors: your name
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \lowcode-ui\src\api\material\login.js
 */
import { axios } from '../../../packages/utils/request'

/**
 *  login: 系统登入
 *  loginSys: 系统登入
 *  logout: 系统登出
 *  getInfo: 获取用户信息
 *  getCurrentUserNav: 获取用户菜单信息
 */
const api = {
  login: '/auth/login',
  logout: '/auth/logout',
  loginSys: '/auth/loginSys',
  getInfo: 'auth/getUserInfo',
  getCurrentUserNav: '/auth/getRouters',
  changePassword: '/auth/changePassword'
}

export function login (data) {
  return axios({
    url: api.login,
    method: 'post',
    data: data
  })
}

export function logout (data) {
  return axios({
    url: api.logout,
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    data: data
  })
}

export function loginSys (data) {
  return axios({
    url: api.loginSys,
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    data: data
  })
}

export function getInfo (parameter) {
  return axios({
    url: api.getInfo,
    method: 'get',
    data: parameter
  })
}

export function getCurrentUserNav (data) {
  return axios({
    url: api.getCurrentUserNav,
    method: 'get',
    data: data
  })
}

export function changePassword (parameter) {
  return axios({
    url: api.changePassword,
    method: 'post',
    data: parameter
  })
}

export default api
