fix: channelStats not defined on admin dashboard

This commit is contained in:
Ник (Claude)
2026-06-10 09:16:35 +03:00
parent 290fc160cc
commit d6cf4d3f0e
+3 -1
View File
@@ -26,13 +26,15 @@ function StatCard({ label, value, icon: Icon, color = 'emerald' }) {
export default async function AdminDashboard() {
const [articles, stats] = await Promise.allSettled([
const [articles, stats, channelSummary] = await Promise.allSettled([
adminListArticles({ limit: 50 }),
getStats(),
getChannelSummary(),
]);
const arts = articles.status === 'fulfilled' ? (Array.isArray(articles.value) ? articles.value : articles.value?.articles || []) : [];
const st = stats.status === 'fulfilled' ? stats.value : null;
const channelStats = channelSummary.status === 'fulfilled' ? channelSummary.value : null;
const published = arts.filter(a => a.status === 'published').length;
const drafts = arts.filter(a => a.status === 'draft').length;