fix:article api, disable metadata
This commit is contained in:
parent
a474aa0b7c
commit
91fa603359
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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: [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue