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>
This commit is contained in:
17
frontend/src/lib/api/recommendations.ts
Normal file
17
frontend/src/lib/api/recommendations.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user