feat: change the default API base URL

This commit is contained in:
Li Xin
2025-04-22 11:03:53 +08:00
parent 5ee1632489
commit 6987ca67c3
2 changed files with 15 additions and 9 deletions

View File

@@ -1,14 +1,20 @@
// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
// SPDX-License-Identifier: MIT
import { env } from "~/env";
export async function generatePodcast(content: string) {
const response = await fetch("/api/podcast/generate", {
method: "post",
headers: {
"Content-Type": "application/json",
const response = await fetch(
(env.NEXT_PUBLIC_API_URL ?? "http://localhost:8000/api") +
"/podcast/generate",
{
method: "post",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ content }),
},
body: JSON.stringify({ content }),
});
);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}