import { httpPostRequest, APIUrlGenerator } from "@/utils/baseHttpService";
import { API_ROUTES } from "@/constant/routes";
import { LoginRequest, LoginResponse } from "@/types/auth";

export const postLogin = async (credentials: LoginRequest) => {
  const response = await httpPostRequest<LoginResponse>(
    APIUrlGenerator(API_ROUTES.ADMIN_LOGIN),
    credentials
  );
  return response.data;
};

export const postLogout = () => {
  localStorage.removeItem("admin_token");
  localStorage.removeItem("admin_refresh_token");
  localStorage.removeItem("admin_user");
  localStorage.removeItem("admin_permissions");
};
