|
96 | 96 | }); |
97 | 97 | let themesResponse = await res.json(); |
98 | 98 | for (t of themesResponse['themes']) { |
99 | | - themes.push({ name: t.name, license: t.license, description: t.description, selected: t.name == configResponse['theme'] }); |
| 99 | + themes.push({ id: t.id, name: t.name, license: t.license, description: t.description, selected: t.name == configResponse['theme'] }); |
100 | 100 | } |
101 | 101 | themes.sort((a, b) => a.name.localeCompare(b.name)); |
102 | 102 | } |
103 | 103 |
|
104 | | - async function saveConfig(themes, desiredThemeName) { |
| 104 | + async function saveConfig(themes, desiredThemeId) { |
105 | 105 | let endpoint = `${getApiBaseUrl()}/api/config`; |
106 | 106 | let headers = { |
107 | 107 | ...{ |
|
114 | 114 | let response = await fetch(endpoint, { |
115 | 115 | method: 'PUT', |
116 | 116 | headers: headers, |
117 | | - body: JSON.stringify({ theme: desiredThemeName }), |
| 117 | + body: JSON.stringify({ theme: desiredThemeId }), |
118 | 118 | }); |
119 | 119 | if (response.ok) { |
120 | 120 | for (let theme of themes) { |
121 | | - theme.selected = theme.name === desiredThemeName; |
| 121 | + theme.selected = theme.id === desiredThemeId; |
122 | 122 | } |
123 | 123 | } else { |
124 | 124 | alert("Error changing theme!"); |
@@ -188,7 +188,7 @@ <h2 class="card-title" x-text="theme.name"></h2> |
188 | 188 | <p>License: <span x-text="theme.license"></span></p> |
189 | 189 | <div class="justify-end card-actions"> |
190 | 190 | <button :class="{'btn-primary': !theme.selected}" class="btn" |
191 | | - x-on:click="await saveConfig(themes, theme.name);">Select</button> |
| 191 | + x-on:click="await saveConfig(themes, theme.id);">Select</button> |
192 | 192 | </div> |
193 | 193 | </div> |
194 | 194 | </div> |
|
0 commit comments