feat: add error messages to user pages

This commit is contained in:
Kentai Radiquum 2025-03-20 22:02:49 +05:00
parent f2f03df1a0
commit d16e4d14d4
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
10 changed files with 285 additions and 136 deletions

View file

@ -16,19 +16,26 @@ export async function generateMetadata(
parent: ResolvingMetadata
): Promise<Metadata> {
const id: string = params.id;
const profile: any = await fetchDataViaGet(
const { data, error } = await fetchDataViaGet(
`https://api.anixart.tv/profile/${id}`
);
const previousOG = (await parent).openGraph;
if (error) {
return {
title: "Ошибка",
description: "Ошибка",
};
};
return {
title: SectionTitleMapping[params.slug] + " - " + profile.profile.login,
description: profile.profile.status,
title:"Закладки Пользователя - " + data.profile.login + " - " + SectionTitleMapping[params.slug],
description: "Закладки Пользователя - " + data.profile.login + " - " + SectionTitleMapping[params.slug],
openGraph: {
...previousOG,
images: [
{
url: profile.profile.avatar, // Must be an absolute URL
url: data.profile.avatar, // Must be an absolute URL
width: 600,
height: 600,
},