import axiosInstance from "./api"; 
import { apiUrl } from "./endpoints"; 
import { LoginRequest , RegisterRequest } from "../types/auth";

export const loginApi = async (payload: LoginRequest) => {
  const res = await axiosInstance.post(apiUrl.login, payload);
  return res.data;
};

export const logoutApi = async () => {
  const res = await axiosInstance.post(apiUrl.logout);
  return res.data;
}
export const registerApi = async (payload: RegisterRequest) => {
  const res = await axiosInstance.post(apiUrl.register, payload);
  return res.data;
};
export const googleLoginApi = async (access_token: string) => {
  const res = await axiosInstance.post(apiUrl.googleLogin, {
    access_token,
  });

  return res.data;
};
export const deleteAccountApi = async () => {
    const res = await axiosInstance.delete(apiUrl.deleteAccount);
    return res.data;
};