Files
waving-hands/src/lib/family.ts
T

24 lines
674 B
TypeScript

// The other games of the Kestrel's Nest, from the family list the kit keeps
// (family.json, one copy shipped with every game), so a player who liked one
// table can find the next. This game is left out of its own list.
export interface FamilyGame {
slug: string;
name: string;
url: string;
pitch: string;
players: string;
origin: string;
}
export async function otherGames(self: string): Promise<FamilyGame[]> {
try {
const res = await fetch('/family.json', { cache: 'no-cache' });
if (!res.ok) return [];
const data = (await res.json()) as { games?: FamilyGame[] };
return (data.games ?? []).filter((g) => g.slug !== self);
} catch {
return [];
}
}