import client from "./client"
import type { ApiResultLoginVo, ApiResultString, LoginVo, UserLoginDto } from "@/types/api"

export async function login(data: UserLoginDto): Promise<LoginVo> {
  const res = await client.post<ApiResultLoginVo>("/api/auth/login", data)
  return res.data.data!
}

export async function logout(): Promise<string | null> {
  const res = await client.post<ApiResultString>("/api/auth/logout")
  return res.data.data
}
