feat: set up mock data to be used to generate baseline profiles
This commit is contained in:
@@ -49,6 +49,17 @@ export function fetchEpisodes(aniListId: number, shouldRetry: boolean = false) {
|
||||
app.openapi(route, async (c) => {
|
||||
const aniListId = Number(c.req.param("aniListId"));
|
||||
|
||||
// Check if we should use mock data
|
||||
const { useMockData } = await import("~/libs/useMockData");
|
||||
if (useMockData()) {
|
||||
const { mockEpisodes } = await import("~/mocks/mockData");
|
||||
|
||||
return c.json({
|
||||
success: true,
|
||||
result: { providerId: "aniwatch", episodes: mockEpisodes() },
|
||||
});
|
||||
}
|
||||
|
||||
const episodes = await fetchEpisodes(aniListId);
|
||||
if (episodes.length === 0) {
|
||||
return c.json(ErrorResponse, { status: 404 });
|
||||
|
||||
Reference in New Issue
Block a user