This commit is contained in:
parent
40029b9839
commit
9ba13d1160
@ -13,10 +13,7 @@ import { Metadata, Viewport } from "next";
|
|||||||
import { ReactElement } from "react";
|
import { ReactElement } from "react";
|
||||||
import { Title } from "@/app/components/title";
|
import { Title } from "@/app/components/title";
|
||||||
|
|
||||||
/**
|
export const revalidate = 60;
|
||||||
* Force the page to be dynamic, so it will be regenerated on every request
|
|
||||||
*/
|
|
||||||
export const revalidate = 0;
|
|
||||||
|
|
||||||
type Params = {
|
type Params = {
|
||||||
params: {
|
params: {
|
||||||
@ -24,6 +21,11 @@ type Params = {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export async function getData(id: string): Promise<CachedPlayer> {
|
||||||
|
console.log("called");
|
||||||
|
return getPlayer(id);
|
||||||
|
}
|
||||||
|
|
||||||
export async function generateViewport({ params: { id } }: Params): Promise<Viewport> {
|
export async function generateViewport({ params: { id } }: Params): Promise<Viewport> {
|
||||||
const validPlayer = await isValidPlayer(id);
|
const validPlayer = await isValidPlayer(id);
|
||||||
return {
|
return {
|
||||||
@ -41,7 +43,7 @@ export async function generateMetadata({ params: { id } }: Params): Promise<Meta
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { username, uniqueId, skin } = await getPlayer(id);
|
const { username, uniqueId, skin } = await getData(id);
|
||||||
const headPartUrl = skin.parts.head;
|
const headPartUrl = skin.parts.head;
|
||||||
|
|
||||||
return generateEmbed({
|
return generateEmbed({
|
||||||
@ -64,7 +66,7 @@ export default async function Page({ params: { id } }: Params): Promise<ReactEle
|
|||||||
|
|
||||||
// Try and get the player to display
|
// Try and get the player to display
|
||||||
try {
|
try {
|
||||||
player = id ? await getPlayer(id) : undefined;
|
player = id ? await getData(id) : undefined;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error = (err as McUtilsAPIError).message; // Set the error message
|
error = (err as McUtilsAPIError).message; // Set the error message
|
||||||
}
|
}
|
||||||
|
@ -20,10 +20,7 @@ import { Metadata, Viewport } from "next";
|
|||||||
import { ReactElement } from "react";
|
import { ReactElement } from "react";
|
||||||
import { Title } from "@/app/components/title";
|
import { Title } from "@/app/components/title";
|
||||||
|
|
||||||
/**
|
export const revalidate = 60;
|
||||||
* Force the page to be dynamic, so it will be regenerated on every request
|
|
||||||
*/
|
|
||||||
export const revalidate = 0;
|
|
||||||
|
|
||||||
type Params = {
|
type Params = {
|
||||||
params: {
|
params: {
|
||||||
|
Loading…
Reference in New Issue
Block a user