mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-09-02 01:20:23 +08:00
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:
@@ -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 }),
|
||||
|
||||
Reference in New Issue
Block a user