import request from '@/utils/request'

export interface LoginResult {
  token: string
  expirationTime: number
  activate: boolean
  userVO: {
    id: number
    name: string
    avatar: string
    temporary: boolean
    certified: boolean
  }
  version: string
}

export function login(username: string, password: string) {
  return request.post<never, { code: number; data: LoginResult; message: string }>(
    '/api/user/login',
    { username, password },
  )
}
