fix:article api, disable metadata
This commit is contained in:
parent
a474aa0b7c
commit
91fa603359
|
|
@ -7,19 +7,19 @@ type Props = {
|
||||||
params: { id: string };
|
params: { id: string };
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function generateMetadata({ params }: any): Promise<Metadata> {
|
// export async function generateMetadata({ params }: any): Promise<Metadata> {
|
||||||
const res = await getArticleById(params.id?.split("-")[0]);
|
// const res = await getArticleById(params.id?.split("-")[0]);
|
||||||
const article = res?.data?.data;
|
// const article = res?.data?.data;
|
||||||
return {
|
// return {
|
||||||
title: article.title,
|
// title: article.title,
|
||||||
description: article.description,
|
// description: article.description,
|
||||||
openGraph: {
|
// openGraph: {
|
||||||
title: article.title,
|
// title: article.title,
|
||||||
description: article.description,
|
// description: article.description,
|
||||||
images: [`${article.thumbnailUrl}`],
|
// images: [`${article.thumbnailUrl}`],
|
||||||
},
|
// },
|
||||||
};
|
// };
|
||||||
}
|
// }
|
||||||
|
|
||||||
export default async function NewsPage({ params }: any) {
|
export default async function NewsPage({ params }: any) {
|
||||||
const articleId = params.id?.split("-")[0];
|
const articleId = params.id?.split("-")[0];
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,13 @@ export default function NewsTicker() {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function getArticle() {
|
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);
|
const response = await getListArticle(req);
|
||||||
setArticle(response?.data?.data);
|
setArticle(response?.data?.data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ export default function SidebarDetail() {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function getArticle() {
|
async function getArticle() {
|
||||||
const req = { page: 1, search: "", limit: "10" };
|
const req = { page: 1, search: "", limit: "10", isPublish: true };
|
||||||
|
|
||||||
const response = await getListArticle(req);
|
const response = await getListArticle(req);
|
||||||
setArticle(response?.data?.data);
|
setArticle(response?.data?.data);
|
||||||
|
|
|
||||||
|
|
@ -52,14 +52,14 @@ const nextConfig = {
|
||||||
eslint: {
|
eslint: {
|
||||||
ignoreDuringBuilds: true,
|
ignoreDuringBuilds: true,
|
||||||
},
|
},
|
||||||
experimental: {
|
// experimental: {
|
||||||
serverActions: true,
|
// serverActions: true,
|
||||||
pwa: {
|
// pwa: {
|
||||||
dest: "public",
|
// dest: "public",
|
||||||
register: true,
|
// register: true,
|
||||||
skipWaiting: true,
|
// skipWaiting: true,
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
images: {
|
images: {
|
||||||
remotePatterns: [
|
remotePatterns: [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ export async function getListArticle(props: PaginationRequest) {
|
||||||
}&title=${search}&startDate=${startDate || ""}&endDate=${
|
}&title=${search}&startDate=${startDate || ""}&endDate=${
|
||||||
endDate || ""
|
endDate || ""
|
||||||
}&categoryId=${category || ""}&sortBy=${sortBy || "created_at"}&sort=${
|
}&categoryId=${category || ""}&sortBy=${sortBy || "created_at"}&sort=${
|
||||||
sort || "asc"
|
sort || "desc"
|
||||||
}&category=${categorySlug || ""}&isBanner=${isBanner || ""}`,
|
}&category=${categorySlug || ""}&isBanner=${isBanner || ""}`,
|
||||||
headers
|
headers
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue