Add theme switching!!!! #18

Merged
twig merged 9 commits from settings-appearance into main 2025-07-05 17:29:46 +00:00
Showing only changes of commit 2c4489917a - Show all commits

View file

@ -60,14 +60,11 @@ function changeTheme(id: string, url: string) {
const fetchThemes = async () => { const fetchThemes = async () => {

Convert to regular function rather than arrow function. (Forgot to comment on this before)

Convert to regular function rather than arrow function. (Forgot to comment on this before)
for (const theme of defaultThemes) { for (const theme of defaultThemes) {
const themeConfig = await fetch(`${baseURL}themes/${theme}.json`) const themeConfig = await $fetch(`${baseURL}themes/${theme}.json`) as Theme

Use $fetch instead of fetch, which among other things automatically parses the body.

Use `$fetch` instead of `fetch`, which among other things automatically parses the body.
const themeConfigJson = await themeConfig.json() as Theme themeConfig.id = theme
themeConfigJson.id = theme
themes.push(themeConfigJson) themes.push(themeConfig)
} }
console.log(themes)
} }
await fetchThemes() await fetchThemes()