import { AuthResponse, LoginPayload, RegisterPayload } from "@/lib/types/user";
import axiosInstance from "./axiosInstance";

export const authService = {
  register: async (payload: RegisterPayload): Promise<AuthResponse> => {
    const res = await axiosInstance.post("/register", payload);
    return res.data;
  },
  login: async (payload: LoginPayload): Promise<AuthResponse> => {
    const res = await axiosInstance.post("/login", payload);
    return res.data;
  },
  logout: async () => {
    await axiosInstance.post("/logout");
  },
  me: async () => {
    const res = await axiosInstance.get("/me");
    return res.data;
  },
};
