fix: add back remaining mock data paths
This commit is contained in:
@@ -1,11 +1,17 @@
|
|||||||
import { env } from "cloudflare:workers";
|
import { env } from "cloudflare:workers";
|
||||||
|
|
||||||
|
import { useMockData } from "~/libs/useMockData";
|
||||||
import type { Title } from "~/types/title";
|
import type { Title } from "~/types/title";
|
||||||
|
|
||||||
export async function fetchTitleFromAnilist(
|
export async function fetchTitleFromAnilist(
|
||||||
id: number,
|
id: number,
|
||||||
token?: string | undefined,
|
token?: string | undefined,
|
||||||
): Promise<Title | undefined> {
|
): Promise<Title | undefined> {
|
||||||
|
if (useMockData()) {
|
||||||
|
const { mockTitleDetails } = await import("~/mocks");
|
||||||
|
return mockTitleDetails();
|
||||||
|
}
|
||||||
|
|
||||||
const durableObjectId = env.ANILIST_DO.idFromName(
|
const durableObjectId = env.ANILIST_DO.idFromName(
|
||||||
id.toString() + (token == null ? "" : "_" + token),
|
id.toString() + (token == null ? "" : "_" + token),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { useMockData } from "~/libs/useMockData";
|
||||||
import { FetchUrlResponse } from "~/types/episode/fetch-url-response";
|
import { FetchUrlResponse } from "~/types/episode/fetch-url-response";
|
||||||
|
|
||||||
import { fetchEpisodes } from "../getByAniListId";
|
import { fetchEpisodes } from "../getByAniListId";
|
||||||
@@ -13,6 +14,11 @@ export async function fetchEpisodeUrl({
|
|||||||
aniListId: number;
|
aniListId: number;
|
||||||
episodeNumber: number;
|
episodeNumber: number;
|
||||||
}): Promise<FetchUrlResponse | null> {
|
}): Promise<FetchUrlResponse | null> {
|
||||||
|
if (useMockData()) {
|
||||||
|
const { mockEpisodeUrl } = await import("~/mocks");
|
||||||
|
return { success: true, result: mockEpisodeUrl };
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let episodeId = id;
|
let episodeId = id;
|
||||||
if (!id) {
|
if (!id) {
|
||||||
|
|||||||
Reference in New Issue
Block a user