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

@ -1,26 +1,33 @@
import { ProfilePage } from "#/pages/Profile";
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: 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: "Профиль - " + profile.profile.login,
description: profile.profile.status,
title: "Профиль - " + data.profile.login,
description: data.profile.status,
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,
},