mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
fix: generate paths
This commit is contained in:
@@ -111,7 +111,7 @@ export async function generateStaticParams() {
|
|||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
} catch {
|
} catch {
|
||||||
return { slug: [] };
|
return { slug: ['packages', '404'] };
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
@@ -162,14 +162,18 @@ async function getData(slug: string[]) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let data;
|
let data;
|
||||||
if (process.env.NEXT_PUBLIC_LOCAL_DEV) {
|
try {
|
||||||
const res = await readFile(join(cwd(), '..', '..', 'packages', packageName, 'docs', 'docs.api.json'), 'utf8');
|
if (process.env.NEXT_PUBLIC_LOCAL_DEV) {
|
||||||
data = JSON.parse(res);
|
const res = await readFile(join(cwd(), '..', '..', 'packages', packageName, 'docs', 'docs.api.json'), 'utf8');
|
||||||
} else {
|
data = JSON.parse(res);
|
||||||
const res = await fetch(`https://docs.discordjs.dev/docs/${packageName}/${branchName}.api.json`, {
|
} else {
|
||||||
next: { revalidate: 3_600 },
|
const res = await fetch(`https://docs.discordjs.dev/docs/${packageName}/${branchName}.api.json`, {
|
||||||
});
|
next: { revalidate: 3_600 },
|
||||||
data = await res.json();
|
});
|
||||||
|
data = await res.json();
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
notFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
const model = createApiModel(data);
|
const model = createApiModel(data);
|
||||||
|
|||||||
Reference in New Issue
Block a user