mirror of
https://github.com/Dokploy/website.git
synced 2026-06-15 20:25:25 +02:00
fix: update build command and API URL for local development
- Modified the build command in package.json to include webpack. - Updated the local API URL in the blog page component to reflect the new development port. - Refactored the Ghost API request handling to prevent sending the slug as a query parameter, improving error handling.
This commit is contained in:
@@ -39,7 +39,7 @@ export async function generateMetadata(
|
||||
"/api/og",
|
||||
process.env.NODE_ENV === "production"
|
||||
? "https://dokploy.com"
|
||||
: "http://localhost:3000",
|
||||
: "http://localhost:3001",
|
||||
);
|
||||
ogUrl.searchParams.set("slug", slug);
|
||||
|
||||
|
||||
@@ -15,10 +15,11 @@ const api = GhostContentAPI({
|
||||
// @ts-ignore
|
||||
makeRequest: ({ url, method, params, headers }) => {
|
||||
const apiUrl = new URL(url);
|
||||
// @ts-ignore
|
||||
Object.keys(params).map((key) =>
|
||||
apiUrl.searchParams.set(key, encodeURIComponent(params[key])),
|
||||
);
|
||||
// Slug is already in the path; Ghost returns 422 if we also send it as query param
|
||||
const { slug: _slug, ...queryParams } = params;
|
||||
for (const key of Object.keys(queryParams)) {
|
||||
apiUrl.searchParams.set(key, encodeURIComponent(queryParams[key]));
|
||||
}
|
||||
|
||||
return fetch(apiUrl.toString(), { method, headers })
|
||||
.then(async (res) => {
|
||||
@@ -31,6 +32,7 @@ const api = GhostContentAPI({
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Fetch error:", error);
|
||||
throw error;
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -95,7 +97,7 @@ export async function getPost(slug: string): Promise<Post | null> {
|
||||
try {
|
||||
const result = (await api.posts.read({
|
||||
slug,
|
||||
include: ["authors"],
|
||||
include: "authors",
|
||||
})) as Post;
|
||||
|
||||
return result;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev --port 3001",
|
||||
"build": "next build",
|
||||
"build": "next build --webpack",
|
||||
"start": "next start",
|
||||
"lint": "next lint",
|
||||
"typecheck": "tsc --noEmit"
|
||||
|
||||
Reference in New Issue
Block a user