mirror of
https://github.com/Radiquum/AniX.git
synced 2025-04-30 18:09:40 +05:00
fix: pages that use fetchDataViaGET
This commit is contained in:
parent
f9ba62d525
commit
8e56a39fe1
7 changed files with 131 additions and 55 deletions
|
@ -1,24 +1,33 @@
|
|||
import { ReleasePage } from "#/pages/Release";
|
||||
import { fetchDataViaGet } from "#/api/utils";
|
||||
import type { Metadata, ResolvingMetadata } from "next";
|
||||
export const dynamic = 'force-static';
|
||||
export const dynamic = "force-static";
|
||||
|
||||
export async function generateMetadata(
|
||||
{ params },
|
||||
parent: ResolvingMetadata
|
||||
): Promise<Metadata> {
|
||||
const id = params.id;
|
||||
const release = await fetchDataViaGet(`https://api.anixart.tv/release/${id}`);
|
||||
const { data, error } = await fetchDataViaGet(
|
||||
`https://api.anixart.tv/release/${id}`
|
||||
);
|
||||
const previousOG = (await parent).openGraph;
|
||||
|
||||
if (error) {
|
||||
return {
|
||||
title: "Ошибка",
|
||||
description: "Ошибка",
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
title: release.release.title_ru,
|
||||
description: release.release.description,
|
||||
title: data.release.title_ru,
|
||||
description: data.release.description,
|
||||
openGraph: {
|
||||
...previousOG,
|
||||
images: [
|
||||
{
|
||||
url: release.release.image, // Must be an absolute URL
|
||||
url: data.release.image, // Must be an absolute URL
|
||||
width: 600,
|
||||
height: 800,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue