/*
 * @Author: donghao donghao@supervision.ltd
 * @Date: 2025-03-12 15:13:38
 * @LastEditors: donghao donghao@supervision.ltd
 * @LastEditTime: 2025-07-10 10:20:57
 * @FilePath: \5G-Loading-Bay-Web\src\api\user.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import request from '@/utils/request/instance'
import { config } from '@/config'

// 定义响应类型
interface LoginRes {
  token: string
  userInfo: {
    id: number
    username: string
  }
}

export const loginApi = (data: { username: string; password: string }) => {
  return request.post<LoginRes>(`/api/user/login/`, data, {
    showLoading: false // 单独关闭loading
  })
}

export const loginOutApi = () => {
  return request.post(
    `/api/user/logout/`,
    {},
    {
      showLoading: false // 单独关闭loading
    }
  )
}
