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