forked from admin/zeropost-tool
feat: billing UI — balance in header + /billing transactions page
- Header: Coins badge с кредитами, ссылка на /billing - app/billing/page.js: баланс, план, стоимость операций, история транзакций - app/api/billing/balance/route.js, transactions/route.js — прокси к engine - lib/engine.js: getBillingBalance, getTransactions, getBillingPlans, adminCreditUser
This commit is contained in:
@@ -76,6 +76,16 @@ export const engine = {
|
||||
},
|
||||
usageRecent: (limit = 20) => call(`/api/usage/recent?limit=${limit}`),
|
||||
|
||||
// Billing
|
||||
getBillingBalance: (userId) => call('/api/billing/balance', { userId }),
|
||||
getBillingPlans: () => fetch('/api/billing/plans', { cache: 'no-store' }).then(r => r.json()),
|
||||
getTransactions: (params = {}) => {
|
||||
const qs = new URLSearchParams(params).toString();
|
||||
return call(`/api/billing/transactions?${qs}`);
|
||||
},
|
||||
adminCreditUser: (data) => call('/api/billing/admin/credit', { method: 'POST', body: data }),
|
||||
adminGetBalances: () => call('/api/billing/admin/users'),
|
||||
|
||||
// Editor notes
|
||||
listNotes: () => call('/api/notes?limit=100'),
|
||||
createNote: (data) => call('/api/notes', { method: 'POST', body: data }),
|
||||
@@ -106,3 +116,4 @@ export const engine = {
|
||||
updateUserPostSchedule: (userId, id, scheduledAt) =>
|
||||
call(`/api/user-posts/${id}`, { userId, method: 'PATCH', body: { scheduled_at: scheduledAt } }),
|
||||
};
|
||||
// Добавляем в конец файла перед module.exports или в общий объект
|
||||
|
||||
Reference in New Issue
Block a user