make my shit work

This commit is contained in:
Иван 2025-12-19 20:41:46 +03:00
parent da29133989
commit ee31b639b2
3 changed files with 48 additions and 42 deletions

View File

@ -4,9 +4,9 @@ const nextConfig: NextConfig = {
images: { images: {
remotePatterns: [ remotePatterns: [
{ {
protocol: "http", protocol: "https",
hostname: "89.169.188.2", hostname: "api.travelmarine.ru",
pathname: '/**' pathname: "/**",
}, },
], ],
unoptimized: true, unoptimized: true,

View File

@ -7,7 +7,7 @@ const useApiClient = () => {
const authPopup = useAuthPopup(); const authPopup = useAuthPopup();
const apiClient = axios.create({ const apiClient = axios.create({
baseURL: "http://89.169.188.2/api", baseURL: "https://api.travelmarine.ru",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
}, },

View File

@ -1,21 +1,26 @@
import { clsx, type ClassValue } from "clsx" import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge" import { twMerge } from "tailwind-merge";
import { differenceInHours, parseISO } from "date-fns"; import { differenceInHours, parseISO } from "date-fns";
export function cn(...inputs: ClassValue[]) { export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs)) return twMerge(clsx(inputs));
} }
const API_BASE_URL = "http://89.169.188.2"; const API_BASE_URL = "https://api.travelmarine.ru";
export const getImageUrl = (relativePath: string): string => { export const getImageUrl = (relativePath: string): string => {
if (!relativePath) return ""; if (!relativePath) return "";
// Если путь уже абсолютный, возвращаем как есть // Если путь уже абсолютный, возвращаем как есть
if (relativePath.startsWith("http://") || relativePath.startsWith("https://")) { if (
relativePath.startsWith("http://") ||
relativePath.startsWith("https://")
) {
return relativePath; return relativePath;
} }
// Убираем начальный слеш, если есть, и формируем абсолютный URL // Убираем начальный слеш, если есть, и формируем абсолютный URL
const cleanPath = relativePath.startsWith("/") ? relativePath.slice(1) : relativePath; const cleanPath = relativePath.startsWith("/")
? relativePath.slice(1)
: relativePath;
return `${API_BASE_URL}/${cleanPath}`; return `${API_BASE_URL}/${cleanPath}`;
}; };
@ -67,7 +72,8 @@ export const calculateTotalPrice = (
// Добавляем разницу в минутах // Добавляем разницу в минутах
const minutesDiff = const minutesDiff =
(arrivalDateTime.getMinutes() - departureDateTime.getMinutes()) / 60; (arrivalDateTime.getMinutes() - departureDateTime.getMinutes()) /
60;
hoursDiff += minutesDiff; hoursDiff += minutesDiff;
// Округляем до ближайших 0.5 часа // Округляем до ближайших 0.5 часа