import { makeRequest } from "@frontend/kitui"
import { parseAxiosError } from "@root/utils/parse-error"

export async function getRecentlyPurchasedTariffs(): Promise<[any | null, string?]> {
	try {
		const recentlyPurchased = await makeRequest<never, any>({
			url: process.env.REACT_APP_DOMAIN + "/customer/recent",
			method: "get",
			useToken: true,
		})
		console.log(recentlyPurchased)
		return [recentlyPurchased]
	} catch (nativeError) {
		const [error] = parseAxiosError(nativeError)

		return [null, `Не удалось получить историю. ${error}`]
	}
}