fix: tipado Social al mezclar posts FB/IG

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
4Ventures
2026-09-24 17:31:02 +02:00
parent 5e5fc87710
commit b0d19e4da5

View File

@@ -618,7 +618,9 @@ export async function GET(req: NextRequest) {
until
);
metrics.facebook = fb;
if (Array.isArray(fb.posts)) posts.push(...fb.posts);
if (!('error' in fb && fb.error) && Array.isArray(fb.posts)) {
posts.push(...fb.posts);
}
}
if (igInteg?.external_account_id) {
const ig = await fetchIgBundle(
@@ -628,7 +630,9 @@ export async function GET(req: NextRequest) {
until
);
metrics.instagram = ig;
if (Array.isArray(ig.posts)) posts.push(...ig.posts);
if (!('error' in ig && ig.error) && Array.isArray(ig.posts)) {
posts.push(...ig.posts);
}
}
} catch (e) {
metrics.warning = e instanceof Error ? e.message : 'metrics error';