()
| 1 | import yaml from 'js-yaml'; |
| 2 | |
| 3 | export async function loadConfig() { |
| 4 | try { |
| 5 | const response = await fetch('/config.yaml'); |
| 6 | if (!response.ok) { |
| 7 | throw new Error(`Failed to fetch config.yaml: ${response.statusText}`); |
| 8 | } |
| 9 | |
| 10 | const yamlText = await response.text(); |
| 11 | const config = yaml.load(yamlText); |
| 12 | |
| 13 | const textTransformClass = config.ui.lowercase ? 'text-lowercase' : 'text-default'; |
| 14 | document.body.classList.add(textTransformClass); |
| 15 | |
| 16 | return config; |
| 17 | } catch (error) { |
| 18 | console.error('[config]: error loading configuration:', error); |
| 19 | throw error; |
| 20 | } |
| 21 | } |
no outgoing calls
no test coverage detected