MCPcopy Create free account
hub / github.com/formkit/formkit / fetchThemes

Function fetchThemes

packages/cli/src/theme.ts:86–100  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

84}
85
86async function fetchThemes() {
87 themeListResponse = await fetch(`${DEFAULT_THEME_API}/themes`)
88 if (!themeListResponse.ok) {
89 error(
90 `Failed to fetch themes from ${DEFAULT_THEME_API}/themes (${themeListResponse.status}). The theme server may be temporarily unavailable.`
91 )
92 }
93 const data = await themeListResponse.json()
94 if (!Array.isArray(data)) {
95 error(
96 `Unexpected response from theme API. Expected an array of themes but received: ${JSON.stringify(data).slice(0, 100)}`
97 )
98 }
99 themes = data
100}
101
102export async function buildTheme(options: Partial<BuildThemeOptions> = {}) {
103 if (!themes.length) await fetchThemes()

Callers 1

buildThemeFunction · 0.85

Calls 1

errorFunction · 0.90

Tested by

no test coverage detected