mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
use relative paths for api backgrounds
This commit is contained in:
1 parent
516df13f62
commit
c134131127
3 files changed
+9
-8
No files matched your search
@@ -406,7 +406,7 @@ export class ServerAPI extends AbstractAPI {
|
|||||||
@Cache()
|
@Cache()
|
||||||
async avatarList() {
|
async avatarList() {
|
||||||
const avatars = await this.avatars();
|
const avatars = await this.avatars();
|
||||||
const list = avatars.avatars.map((avatar) => avatar.name);
|
const list = avatars.avatars.map((avatar) => avatar.id);
|
||||||
|
|
||||||
return { list };
|
return { list };
|
||||||
}
|
}
|
||||||
@@ -414,14 +414,13 @@ export class ServerAPI extends AbstractAPI {
|
|||||||
@Cache()
|
@Cache()
|
||||||
async background(id: string) {
|
async background(id: string) {
|
||||||
const background = this.metadata.item(id);
|
const background = this.metadata.item(id);
|
||||||
const name = background.name;
|
|
||||||
const stuff_ui = background.StuffUI("UIComponent");
|
const stuff_ui = background.StuffUI("UIComponent");
|
||||||
const profile_background = background.ProfileBackground();
|
const profile_background = background.ProfileBackground();
|
||||||
const sellable = background.components.sellableComponent
|
const sellable = background.components.sellableComponent
|
||||||
? background.Sellable()
|
? background.Sellable()
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
return { name, stuff_ui, profile_background, sellable };
|
return { id, stuff_ui, profile_background, sellable };
|
||||||
}
|
}
|
||||||
|
|
||||||
@Cache()
|
@Cache()
|
||||||
|
|||||||
@@ -5,10 +5,7 @@ import { getStaticPaths as _getStaticPaths } from "../_index";
|
|||||||
|
|
||||||
export const getStaticPaths = mixStaticPaths(_getStaticPaths, async () => {
|
export const getStaticPaths = mixStaticPaths(_getStaticPaths, async () => {
|
||||||
const { backgrounds } = await api.backgrounds();
|
const { backgrounds } = await api.backgrounds();
|
||||||
|
return backgrounds.map(({ id }) => ({ params: { id } }));
|
||||||
return backgrounds.map((background) => ({
|
|
||||||
params: { id: background.name },
|
|
||||||
}));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function GET({ params }: APIContext<never, { id: string }>) {
|
export async function GET({ params }: APIContext<never, { id: string }>) {
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
import type { APIContext } from "astro";
|
import type { APIContext } from "astro";
|
||||||
import { api } from "../../../api/dynamic";
|
import { api } from "../../../api/dynamic";
|
||||||
import { imageProxy } from "../../../api/imageProxy";
|
import { imageProxy } from "../../../api/imageProxy";
|
||||||
|
import { getStaticPaths as _getStaticPaths } from "../_index";
|
||||||
|
import { mixStaticPaths } from "../../../astro/mixStaticPaths";
|
||||||
|
|
||||||
export { getStaticPaths } from "../../[api]/backgrounds/[id].json";
|
export const getStaticPaths = mixStaticPaths(_getStaticPaths, async () => {
|
||||||
|
const { backgrounds } = await api.backgrounds();
|
||||||
|
return backgrounds.map(({ id }) => ({ params: { id } }));
|
||||||
|
});
|
||||||
|
|
||||||
export async function GET({ params }: APIContext<never, { id: string }>) {
|
export async function GET({ params }: APIContext<never, { id: string }>) {
|
||||||
const background = await api.background(params.id);
|
const background = await api.background(params.id);
|
||||||
|
|||||||
Reference in new issue
Block a user