www/src/mods.ts
mr. M 0294253151
Worked on the site a bit more
Co-authored-by: Eveeifyeve <Eveeifyeve@users.noreply.github.com>
2024-12-08 13:57:19 +01:00

31 lines
681 B
TypeScript

export interface ZenTheme {
name: string;
description: string;
image: string;
downloadUrl: string;
id: string;
homepage?: string;
readme: string;
preferences?: string;
isColorTheme: boolean;
author: string;
version: string;
tags: string[];
createdAt: Date;
updatedAt: Date;
}
const THEME_API = "https://zen-browser.github.io/theme-store/themes.json";
export async function getAllMods(): Promise<ZenTheme[]> {
try {
const res = await fetch(THEME_API);
const json = await res.json();
// convert dict to array
const mods = Object.keys(json).map((key) => json[key]);
return mods;
} catch (error) {
console.error(error);
return [];
}
}