Support new backend contracts: single-flight refresh, ad impression tokens, error handling

- apiFetch: proactive refresh, cross-tab single-flight via Web Locks, no logout on transient errors
- AuthContext: save tokens returned on own login change, revoke refresh on logout, sync tabs
- Ads: X-Session-Id, impressionToken in impression/click, IAB viewability, safe http(s) targetUrl
- STOMP: refresh before CONNECT, stop reconnect loop on dead session, /user/queue/errors behind flag
- Auth form: password 8 chars / 72 bytes; 429/413 messages via describeApiError
- My posts with auth + moderation badges; post form step validation and field limits
- Map: escape user text in Yandex hint/template

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
SlimusMinus
2026-10-20 02:03:42 +03:00
parent 67de963d6d
commit db37befb8d
34 changed files with 1005 additions and 260 deletions

View File

@@ -8,6 +8,7 @@ import {useContactSeller} from "../hooks/useContactSeller";
import {useAuthContext} from "../context/AuthContext";
import {getImageUrl} from "../config/authConstants";
import {CATEGORY_PET} from "../config/feedConstants";
import {POST_STATUS_CLOSED, POST_STATUS_MODERATION, POST_STATUS_REJECTED} from "../config/postConstants";
import {getFoundAt, formatFoundDate} from "../utils/foundAt";
import DateCalendarPopup from "../components/DateCalendarPopup";
import RewardPopup from "../components/feed/RewardPopup";
@@ -93,7 +94,10 @@ export default function PostOnFeed({ ad, onEdit, onDelete, onMarkFound, onReopen
? new Date(ad.createdAt).toLocaleDateString("ru-RU")
: null;
const isClosed = ad.status === 'CLOSED';
const isClosed = ad.status === POST_STATUS_CLOSED;
const pendingStatusText = ad.status === POST_STATUS_MODERATION
? t('postCard.statusModeration')
: ad.status === POST_STATUS_REJECTED ? t('postCard.statusRejected') : null;
// Для питомцев «найдено» — это хорошая новость с воссоединением, поэтому
// формулировка эмоциональнее, чем сухое «Найдено».
const isPet = ad.category === CATEGORY_PET;
@@ -129,6 +133,11 @@ export default function PostOnFeed({ ad, onEdit, onDelete, onMarkFound, onReopen
)}
</div>
<div className="f-card-head-side">
{pendingStatusText && (
<div className={`f-status-badge${ad.status === POST_STATUS_REJECTED ? " f-status-badge-rejected" : ""}`}>
{pendingStatusText}
</div>
)}
{typeBadge}
</div>
</div>