Files
Mangalord/frontend/src/lib/api/recommendations.ts
MechaCat02 19db66a845 feat(home): add a "Recommended for you" shelf
Surface the content-based /me/recommendations feed as a horizontal shelf on
the homepage, below the Continue-reading shelf. Fetched after the catalogue
(same non-blocking pattern), shown only when signed in and the feed is
non-empty; reuses MangaCard in a fixed-width scroller. Component unit test +
e2e (signed-in shows cards, anonymous hides).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-05 17:46:33 +02:00

18 lines
574 B
TypeScript

import { ApiError, request } from './client';
import type { MangaCard } from './mangas';
/**
* GET /v1/me/recommendations — content-based "Recommended for you" feed.
* Returns an empty list for guests (401) so callers can render nothing
* without special-casing auth.
*/
export async function listMyRecommendations(): Promise<MangaCard[]> {
try {
const r = await request<{ items: MangaCard[] }>('/v1/me/recommendations');
return r.items;
} catch (e) {
if (e instanceof ApiError && e.status === 401) return [];
throw e;
}
}