
import { RequestMethod } from "../common.types";
import { request } from "../request";

export interface IUserLoginRequest {
  email: string;
  password: string;
  rememberMe?: boolean;
}

export interface IUserLoginResponse {
  token: string;
}

export interface IUserMeResponse {
  id: string;
  email: string;
  name: string;
}

export const UserApiPath = {
  login: "/user/login",
  me: "/user/me",
};

export const User = {
  login: async (data: IUserLoginRequest) =>
    request<IUserLoginResponse>(RequestMethod.POST, UserApiPath.login, data),
  me: async () => request<IUserMeResponse>(RequestMethod.GET, UserApiPath.me),
};
