fix: channelStats not defined on admin dashboard
This commit is contained in:
@@ -26,13 +26,15 @@ function StatCard({ label, value, icon: Icon, color = 'emerald' }) {
|
|||||||
|
|
||||||
export default async function AdminDashboard() {
|
export default async function AdminDashboard() {
|
||||||
|
|
||||||
const [articles, stats] = await Promise.allSettled([
|
const [articles, stats, channelSummary] = await Promise.allSettled([
|
||||||
adminListArticles({ limit: 50 }),
|
adminListArticles({ limit: 50 }),
|
||||||
getStats(),
|
getStats(),
|
||||||
|
getChannelSummary(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const arts = articles.status === 'fulfilled' ? (Array.isArray(articles.value) ? articles.value : articles.value?.articles || []) : [];
|
const arts = articles.status === 'fulfilled' ? (Array.isArray(articles.value) ? articles.value : articles.value?.articles || []) : [];
|
||||||
const st = stats.status === 'fulfilled' ? stats.value : null;
|
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 published = arts.filter(a => a.status === 'published').length;
|
||||||
const drafts = arts.filter(a => a.status === 'draft').length;
|
const drafts = arts.filter(a => a.status === 'draft').length;
|
||||||
|
|||||||
Reference in New Issue
Block a user