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-29 13:51:16 +08:00
committed by dayuan.jiang
parent 03e2d9da9d
commit f09d2c100a

View File

@@ -1,4 +1,5 @@
import { z } from "zod"
import { getApiEndpoint } from "@/lib/base-path"
export interface UrlData {
url: string
@@ -15,7 +16,7 @@ const UrlResponseSchema = z.object({
})
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",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ url }),