feat: set up mock data to be used to generate baseline profiles
This commit is contained in:
@@ -46,6 +46,14 @@ app.openapi(route, async (c) => {
|
||||
const aniListId = Number(c.req.query("id"));
|
||||
const aniListToken = c.req.header("X-AniList-Token");
|
||||
|
||||
// Check if we should use mock data
|
||||
const { useMockData } = await import("~/libs/useMockData");
|
||||
if (useMockData()) {
|
||||
const { mockTitleDetails } = await import("~/mocks/mockData");
|
||||
|
||||
return c.json({ success: true, result: mockTitleDetails() }, 200);
|
||||
}
|
||||
|
||||
const { result: title, errorOccurred } = await fetchFromMultipleSources([
|
||||
() => fetchTitleFromAnilist(aniListId, aniListToken ?? undefined),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user