refactor: create getCurrentDomain helper function

This commit is contained in:
2024-09-08 14:36:36 -05:00
parent d4a5a4fbb1
commit 090a7504aa
2 changed files with 7 additions and 1 deletions

View File

@@ -8,6 +8,7 @@ import { z } from "zod";
import { Case, changeStringCase } from "~/libs/changeStringCase";
import type { AdminSdkCredentials } from "~/libs/fcm/getGoogleAuthToken";
import { sendFcmMessage } from "~/libs/fcm/sendFcmMessage";
import { getCurrentDomain } from "~/libs/getCurrentDomain";
import { verifyQstashHeader } from "~/libs/qstash/verifyQstashHeader";
import { readEnvVariable } from "~/libs/readEnvVariable";
import { getTokensSubscribedToTitle } from "~/models/token";
@@ -42,7 +43,7 @@ app.post(
return c.json(ErrorResponse, { status: 401 });
}
const domain = c.req.url.replace(c.req.path, "");
const domain = getCurrentDomain(c.req);
const { success, result: fetchEpisodesResult } = await fetch(
`${domain}/episodes/${aniListId}`,
).then((res) => res.json<EpisodesResponseSchema>());