fixed image storage local on minio

This commit is contained in:
SlimusMinus
2026-07-10 01:24:58 +03:00
parent 7e9053e498
commit a344540267
9 changed files with 37 additions and 22 deletions

View File

@@ -4,7 +4,7 @@ import { useChats } from "../hooks/useChats";
import { useAuthContext } from "../context/AuthContext";
import { useUnread } from "../context/UnreadContext";
import { getPostForChat } from "../stores/chatPostStore";
import { API_URL } from "../config/authConstants";
import { getImageUrl } from "../config/authConstants";
import { useDeleteChat } from "../hooks/useDeleteChat";
import TrashIcon from "../components/icons/TrashIcon";
import { useTranslation } from 'react-i18next';
@@ -75,7 +75,7 @@ export default function ChatListPage() {
{!loading && chats.map((chat) => {
const post = getPostForChat(chat.id);
const title = post?.title || chat.otherUser?.name || t('chat.user');
const imgSrc = post?.images?.[0] ? `${API_URL}${post.images[0]}` : null;
const imgSrc = getImageUrl(post?.images?.[0]);
const emoji = post?.emoji;
const unreadCount = unreadMap[chat.id] ?? chat.unreadCount ?? chat.unreadMessages ?? 0;
return (

View File

@@ -5,7 +5,7 @@ import { useChatSocket } from "../hooks/useChatSocket";
import { getPostForChat } from "../stores/chatPostStore";
import { setActiveChatId } from "../stores/activeChatStore";
import { useUnread } from "../context/UnreadContext";
import { API_URL } from "../config/authConstants";
import { getImageUrl } from "../config/authConstants";
import Picker from "@emoji-mart/react";
import emojiData from "@emoji-mart/data";
import { useTranslation } from 'react-i18next';
@@ -69,7 +69,7 @@ export default function ChatPage() {
};
const post = getPostForChat(chatId);
const postImg = post?.images?.[0] ? `${API_URL}${post.images[0]}` : null;
const postImg = getImageUrl(post?.images?.[0]);
return (
<div className="f-app">

View File

@@ -1,7 +1,7 @@
import { useState, useEffect, useCallback, useMemo, useRef } from "react";
import { useNavigate, useLocation } from "react-router-dom";
import "../styles/index.css";
import { API_URL } from "../config/authConstants";
import { API_URL, getImageUrl } from "../config/authConstants";
import Sidebar from "../components/Sidebar";
import RightSidebar from "../components/RightSidebar";
import PostOnFeed from "../components/PostOnFeed";
@@ -78,11 +78,7 @@ export default function MainFeed() {
const firstName = user.firstName || nameParts[0] || "";
const lastName = user.lastName || nameParts.slice(1).join(" ") || "";
// Аватар может быть относительным путём (/uploads/avatars/...) — добавляем API_URL
const rawAvatar = user.avatar || null;
const avatar = rawAvatar && rawAvatar.startsWith("/")
? `${API_URL}${rawAvatar}`
: rawAvatar;
const avatar = getImageUrl(user.avatar);
return {
login: user.login || "",

View File

@@ -1,6 +1,6 @@
import { useState, useCallback, useEffect } from "react";
import { useNavigate } from "react-router-dom";
import { API_URL } from "../config/authConstants";
import { API_URL, getImageUrl } from "../config/authConstants";
import { useAuthContext } from "../context/AuthContext";
import MenuIcon from "../components/icons/MenuIcon";
import Sidebar from "../components/Sidebar";
@@ -140,7 +140,7 @@ export default function ReviewsPage() {
lastName: user.lastName || (user.name || "").trim().split(/\s+/).slice(1).join(" ") || "",
email: user.email || "",
phone: user.phone || "",
avatar: user.avatar && user.avatar.startsWith("/") ? `${API_URL}${user.avatar}` : user.avatar || null,
avatar: getImageUrl(user.avatar),
id: user.id,
}
: {};