/*
 * @Author: wjc
 * @Date: 2024-06-12 10:05:12
 * @LastEditors: wjc
 * @LastEditTime: 2024-06-17 15:09:11
 * @Description:
 */
import { request } from '@/utils/request'
import { BasicRes } from '@/models/requestTypes'
import { ILogin, LoginRes, Employees } from '@/models/userTypes'

export function login(data: ILogin) {
  return request<BasicRes<LoginRes>>({
    url: 'auth/login',
    method: 'POST',
    header: {
      entcode: data.entCode,
    },
    data: {
      account: data.account,
      password: data.password,
    },
  })
}

export function logout() {
  return request<BasicRes<string>>({
    url: 'auth/logout',
    method: 'GET',
  })
}

export function getUserInfo(data: string) {
  return request<BasicRes<Employees>>({
    url: `auth/employees/${data}`,
    method: 'GET',
  })
}
