mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-12-05 15:52:55 +01:00
feat: game strings api
This commit is contained in:
1 parent
a2d0d2d8c0
commit
2d282a3261
3 files changed
+83
-18
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import locales from "@blitzkit/i18n/locales.json";
|
||||
import type { GetStaticPaths, GetStaticPathsResult } from "astro";
|
||||
import { api } from "../../../../core/api/dynamic";
|
||||
|
||||
export const getStaticPaths = (async () => {
|
||||
const paths: GetStaticPathsResult = [];
|
||||
const groups = await api.gameStringGroups();
|
||||
|
||||
for (const { locale } of locales.supported) {
|
||||
for (const group of groups) {
|
||||
paths.push({ params: { locale, group } });
|
||||
}
|
||||
}
|
||||
|
||||
return paths;
|
||||
}) satisfies GetStaticPaths;
|
||||
|
||||
export async function GET({
|
||||
params,
|
||||
}: {
|
||||
params: { locale: string; group: string };
|
||||
}) {
|
||||
const strings = await api.groupedGameStrings(params.locale, params.group);
|
||||
return Response.json(strings);
|
||||
}
|
||||
Reference in new issue
Block a user