Uses dynamic API endpoint for URL parsing

Replaces hardcoded API path with a dynamic endpoint resolver to support flexible deployments and ensure correct API routing in different environments.
This commit is contained in:
shibamudi
2026-01-30 00:02:26 +09:00
committed by dayuan.jiang
parent 699767f392
commit 19dd4e287f
+2 -1
View File
@@ -1,4 +1,5 @@
import { z } from "zod" import { z } from "zod"
import { getApiEndpoint } from "@/lib/base-path"
export interface UrlData { export interface UrlData {
url: string url: string
@@ -15,7 +16,7 @@ const UrlResponseSchema = z.object({
}) })
export async function extractUrlContent(url: string): Promise<UrlData> { export async function extractUrlContent(url: string): Promise<UrlData> {
const response = await fetch("/api/parse-url", { const response = await fetch(getApiEndpoint("/api/parse-url"), {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ url }), body: JSON.stringify({ url }),