Update Backend
This commit is contained in:
@@ -33,19 +33,19 @@ export const schemTypes = cached<SchematicType[]>([], () =>
|
||||
.then(res => res.json()));
|
||||
|
||||
export const players = cached<Player[]>([], async () => {
|
||||
const res = await fetchWithToken(get(tokenStore), "/data/users");
|
||||
const res = await fetchWithToken(get(tokenStore), "/data/admin/users");
|
||||
return z.array(PlayerSchema).parse(await res.json());
|
||||
});
|
||||
|
||||
export const gamemodes = cached<string[]>([], async () => {
|
||||
const res = await fetchWithToken(get(tokenStore), "/data/gamemodes");
|
||||
const res = await fetchWithToken(get(tokenStore), "/data/admin/gamemodes");
|
||||
return z.array(z.string()).parse(await res.json());
|
||||
});
|
||||
|
||||
export const maps = cachedFamily<string, string[]>([], async (gamemode) => {
|
||||
if (get(gamemodes).every(value => value !== gamemode)) return [];
|
||||
|
||||
const res = await fetchWithToken(get(tokenStore), `/data/gamemodes/${gamemode}/maps`);
|
||||
const res = await fetchWithToken(get(tokenStore), `/data/admin/gamemodes/${gamemode}/maps`);
|
||||
if (!res.ok) {
|
||||
return [];
|
||||
} else {
|
||||
@@ -54,7 +54,7 @@ export const maps = cachedFamily<string, string[]>([], async (gamemode) => {
|
||||
});
|
||||
|
||||
export const groups = cached<string[]>([], async () => {
|
||||
const res = await fetchWithToken(get(tokenStore), "/data/groups");
|
||||
const res = await fetchWithToken(get(tokenStore), "/data/admin/groups");
|
||||
return z.array(z.string()).parse(await res.json());
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user