forked from admin/zeropost-tool
feat: billing complete — plans page, admin billing, credit cost hints
/plans: страница тарифов с карточками, стоимостью операций, FAQ /system → Биллинг: таблица пользователей с кредитами, ручное начисление ChannelView: badge стоимости (2кр текст + 5кр картинка) под кнопкой генерации Ошибка INSUFFICIENT_CREDITS → понятное сообщение После генерации — event credits-updated → обновление badge в header Header: подписка на credits-updated event API роуты: /api/billing/plans, /api/billing/admin/users, /api/billing/admin/credit
This commit is contained in:
@@ -11,10 +11,11 @@ export default function Header({ user }) {
|
||||
|
||||
useEffect(() => {
|
||||
if (!user) return;
|
||||
fetch('/api/billing/balance')
|
||||
.then(r => r.json())
|
||||
.then(d => setCredits(d.isUnlimited ? '∞' : d.credits))
|
||||
.catch(() => {});
|
||||
const refresh = () => fetch('/api/billing/balance').then(r => r.json())
|
||||
.then(d => setCredits(d.isUnlimited ? '∞' : d.credits)).catch(() => {});
|
||||
refresh();
|
||||
window.addEventListener('credits-updated', refresh);
|
||||
return () => window.removeEventListener('credits-updated', refresh);
|
||||
}, [user?.id]);
|
||||
|
||||
async function logout() {
|
||||
|
||||
Reference in New Issue
Block a user