fix:article api, disable metadata

This commit is contained in:
Rama Priyanto 2025-05-18 00:54:55 +07:00
parent a474aa0b7c
commit 91fa603359
5 changed files with 30 additions and 24 deletions

View File

@ -7,19 +7,19 @@ type Props = {
params: { id: string };
};
export async function generateMetadata({ params }: any): Promise<Metadata> {
const res = await getArticleById(params.id?.split("-")[0]);
const article = res?.data?.data;
return {
title: article.title,
description: article.description,
openGraph: {
title: article.title,
description: article.description,
images: [`${article.thumbnailUrl}`],
},
};
}
// export async function generateMetadata({ params }: any): Promise<Metadata> {
// const res = await getArticleById(params.id?.split("-")[0]);
// const article = res?.data?.data;
// return {
// title: article.title,
// description: article.description,
// openGraph: {
// title: article.title,
// description: article.description,
// images: [`${article.thumbnailUrl}`],
// },
// };
// }
export default async function NewsPage({ params }: any) {
const articleId = params.id?.split("-")[0];

View File

@ -12,7 +12,13 @@ export default function NewsTicker() {
useEffect(() => {
async function getArticle() {
const req = { page: 1, search: "", limit: "10" };
const req = {
page: 1,
search: "",
limit: "10",
sortBy: "created_at",
sort: "desc",
};
const response = await getListArticle(req);
setArticle(response?.data?.data);
}

View File

@ -17,7 +17,7 @@ export default function SidebarDetail() {
useEffect(() => {
async function getArticle() {
const req = { page: 1, search: "", limit: "10" };
const req = { page: 1, search: "", limit: "10", isPublish: true };
const response = await getListArticle(req);
setArticle(response?.data?.data);

View File

@ -52,14 +52,14 @@ const nextConfig = {
eslint: {
ignoreDuringBuilds: true,
},
experimental: {
serverActions: true,
pwa: {
dest: "public",
register: true,
skipWaiting: true,
},
},
// experimental: {
// serverActions: true,
// pwa: {
// dest: "public",
// register: true,
// skipWaiting: true,
// },
// },
images: {
remotePatterns: [
{

View File

@ -32,7 +32,7 @@ export async function getListArticle(props: PaginationRequest) {
}&title=${search}&startDate=${startDate || ""}&endDate=${
endDate || ""
}&categoryId=${category || ""}&sortBy=${sortBy || "created_at"}&sort=${
sort || "asc"
sort || "desc"
}&category=${categorySlug || ""}&isBanner=${isBanner || ""}`,
headers
);