mirror of
https://github.com/Radiquum/AniX.git
synced 2025-04-05 15:54:39 +00:00
41 lines
1 KiB
TypeScript
41 lines
1 KiB
TypeScript
import { BookmarksPage } from "#/pages/Bookmarks";
|
|
import { fetchDataViaGet } from "#/api/utils";
|
|
import type { Metadata, ResolvingMetadata } from "next";
|
|
export const dynamic = "force-static";
|
|
|
|
export async function generateMetadata(
|
|
{ params },
|
|
parent: ResolvingMetadata
|
|
): Promise<Metadata> {
|
|
const id: string = params.id;
|
|
const { data, error } = await fetchDataViaGet(
|
|
`https://api.anixart.tv/profile/${id}`
|
|
);
|
|
const previousOG = (await parent).openGraph;
|
|
|
|
if (error) {
|
|
return {
|
|
title: "Ошибка",
|
|
description: "Ошибка",
|
|
};
|
|
};
|
|
|
|
return {
|
|
title: "Закладки Пользователя - " + data.profile.login,
|
|
description: "Закладки Пользователя - " + data.profile.login,
|
|
openGraph: {
|
|
...previousOG,
|
|
images: [
|
|
{
|
|
url: data.profile.avatar, // Must be an absolute URL
|
|
width: 600,
|
|
height: 600,
|
|
},
|
|
],
|
|
},
|
|
};
|
|
}
|
|
|
|
export default function Index({ params }) {
|
|
return <BookmarksPage profile_id={params.id} />;
|
|
}
|