import axios from "@/config/axios";
import axiosBase from "axios";
import type { DirectLoginParamsTypes } from "../types/Types";

export const refreshToken = async ({
  refreshToken,
}: {
  refreshToken: string;
}) => {
  const { data } = await axios.post(`/admin/auth/refresh`, {
    refreshToken: refreshToken,
  });
  return data;
};

export const directLogin = async (params: DirectLoginParamsTypes) => {
  const { data } = await axiosBase.post(
    `${import.meta.env.VITE_API_URL}/super-admin/auth/direct-login`,
    params,
    {
      headers: {
        Authorization: "Basic ZGFuYWtAZHNjLmNvbTpEc0NkQW5Baz9AQUJD",
      },
    },
  );
  return data;
};
