import axiosInstance from "@/apis/axios.config";
import { type ILoginUserFrom, type ILoginEmailFrom } from "@/types/user";

const AUTH_PREFIX = "/api/auth"

const authApis = {
    login: (userForm: ILoginUserFrom) => {
        return axiosInstance.post(`${AUTH_PREFIX}/login`, {
            ...userForm
        })
    },

    loginByEmail: (userForm: ILoginEmailFrom) => {
        return axiosInstance.post(`${AUTH_PREFIX}/loginByEmail`, {
            ...userForm
        })
    },

    authToken:(token: string) => {
        return axiosInstance.get(`${AUTH_PREFIX}/token?token=${encodeURIComponent(token)}`);
    }

}

export default authApis
