import axios from "@/config/axios";
import {
  ApiResponse,
  AuthenticationType,
  RefreshTokenResponse,
  RefreshTokenType,
  VerifyOtpType,
} from "../types/Types";

export const authentication = async (params: AuthenticationType) => {
  const { data } = await axios.post("/user/authenticate", params);
  return data;
};

export const verifyOtp = async (params: VerifyOtpType) => {
  const { data } = await axios.post("/user/login/otp", params);
  return data;
};

export const refreshToken = async (
  params: RefreshTokenType
): Promise<ApiResponse<RefreshTokenResponse>> => {
  const { data } = await axios.post(`/user/token`, params);
  return data;
};
