// @ts-ignore
/* eslint-disable */
import { AdminAPI } from '@/constants/api';
import { request } from '@umijs/max';
import { md5 } from 'js-md5';

export async function currentUser(options?: { [key: string]: any }) {
  return request<API.CurrentUser>(AdminAPI.USER, {
    method: 'POST',
    ...(options || {}),
  });
}

export async function login(body: API.LoginParams, options?: { [key: string]: any }) {
  body.pwd = md5(body.pwd || '');
  return request<API.LoginResult>(AdminAPI.LOGIN, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

export async function outLogin(options?: { [key: string]: any }) {
  // return request<Record<string, any>>(AdminAPI.OUT_LOGIN, {
  //   method: 'POST',
  //   ...(options || {}),
  // });
}
