Use VITE_THEMES_URL for the default theme manifest

- typed `ImportMeta` to have `env`
This commit is contained in:
brecert 2021-09-06 06:38:53 -04:00
parent 6d85c9b725
commit 6a32e451ac
No known key found for this signature in database
GPG key ID: 1B2E56B9EC985B96
2 changed files with 7 additions and 2 deletions

4
src/env.d.ts vendored
View file

@ -2,3 +2,7 @@ interface ImportMetaEnv {
VITE_API_URL: string; VITE_API_URL: string;
VITE_THEMES_URL: string; VITE_THEMES_URL: string;
} }
interface ImportMeta {
env: ImportMetaEnv
}

View file

@ -5,10 +5,11 @@ import { Theme, generateVariables } from '../../../context/Theme'
import { dispatch } from "../../../redux" import { dispatch } from "../../../redux"
export const fetchManifest = (): Promise<Manifest> => export const fetchManifest = (): Promise<Manifest> =>
fetch(`//bree.dev/revolt-themes/manifest.json`).then(res => res.json()) fetch(`${import.meta.env.VITE_THEMES_URL}/manifest.json`).then(res => res.json())
export const fetchTheme = (slug: string): Promise<Theme> => export const fetchTheme = (slug: string): Promise<Theme> =>
fetch(`//bree.dev/revolt-themes/theme_${slug}.json`).then(res => res.json()) fetch(`${import.meta.env.VITE_THEMES_URL}/theme_${slug}.json`).then(res => res.json())
interface ThemeMetadata { interface ThemeMetadata {
name: string, name: string,