mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-29 18:13:47 +00:00
Merge PR #507: секция вывода средств — всем реферерам
Гейт partner_status === 'approved' был чисто фронтовым: бэкенд-эндпоинты вывода и referral_withdrawal_service партнёрство не проверяют, а страница запроса вывода тоже не гейтится. Секция остаётся под админским флагом partner_section_visible. Закрывает #472. Спасибо @kewldan.
This commit is contained in:
@@ -101,17 +101,21 @@ export default function Referral() {
|
|||||||
|
|
||||||
const isPartner = partnerStatus?.partner_status === 'approved';
|
const isPartner = partnerStatus?.partner_status === 'approved';
|
||||||
|
|
||||||
// Withdrawal queries (only when partner is approved)
|
// Withdrawal is available to any referrer: the backend endpoints
|
||||||
|
// (/cabinet/referral/withdrawal/*) do not require partner_status, so the
|
||||||
|
// section is gated only by the admin visibility flag.
|
||||||
|
const withdrawalVisible = terms?.partner_section_visible !== false;
|
||||||
|
|
||||||
const { data: withdrawalBalance } = useQuery({
|
const { data: withdrawalBalance } = useQuery({
|
||||||
queryKey: ['withdrawal-balance'],
|
queryKey: ['withdrawal-balance'],
|
||||||
queryFn: withdrawalApi.getBalance,
|
queryFn: withdrawalApi.getBalance,
|
||||||
enabled: isPartner,
|
enabled: withdrawalVisible,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { data: withdrawalHistory } = useQuery({
|
const { data: withdrawalHistory } = useQuery({
|
||||||
queryKey: ['withdrawal-history'],
|
queryKey: ['withdrawal-history'],
|
||||||
queryFn: withdrawalApi.getHistory,
|
queryFn: withdrawalApi.getHistory,
|
||||||
enabled: isPartner,
|
enabled: withdrawalVisible,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Withdrawal cancel mutation
|
// Withdrawal cancel mutation
|
||||||
@@ -540,9 +544,9 @@ export default function Referral() {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* ==================== Withdrawal Section (approved partners only) ==================== */}
|
{/* ==================== Withdrawal Section ==================== */}
|
||||||
|
|
||||||
{terms?.partner_section_visible !== false && isPartner && (
|
{withdrawalVisible && (
|
||||||
<div id="withdrawal-section" className="space-y-6">
|
<div id="withdrawal-section" className="space-y-6">
|
||||||
{/* Withdrawal Balance Card */}
|
{/* Withdrawal Balance Card */}
|
||||||
{withdrawalBalance && (
|
{withdrawalBalance && (
|
||||||
|
|||||||
Reference in New Issue
Block a user