|
70 | 70 | themes.length = 0;
|
71 | 71 |
|
72 | 72 | let endpoint = `${getSiteApiBaseUrl(site.domain)}/api/config`;
|
73 |
| - const res = await fetch(new URL(endpoint), { |
74 |
| - headers: { authorization: await getNostrAuthHeader(endpoint, 'GET') } |
| 73 | + let res = await fetch(new URL(endpoint), { |
| 74 | + headers: { authorization: await getNostrAuthHeader(endpoint, 'GET') } |
75 | 75 | });
|
76 |
| - let config = await res.json(); |
77 |
| - for (t of config['available_themes']) { |
78 |
| - themes.push({theme: t, selected: t == config['theme']}); |
| 76 | + let configResponse = await res.json(); |
| 77 | + endpoint = `${getSiteApiBaseUrl(site.domain)}/api/themes`; |
| 78 | + res = await fetch(new URL(endpoint), { |
| 79 | + headers: { authorization: await getNostrAuthHeader(endpoint, 'GET') } |
| 80 | + }); |
| 81 | + let themesResponse = await res.json(); |
| 82 | + for (t of themesResponse['themes']) { |
| 83 | + themes.push({name: t.name, selected: t.name == configResponse['theme']}); |
79 | 84 | }
|
80 | 85 | }
|
81 | 86 |
|
@@ -148,7 +153,7 @@ <h1 class="text-2xl text-center" x-text="site.domain"></h1>
|
148 | 153 | <div class="w-full mt-24">
|
149 | 154 | <select id="selectTheme">
|
150 | 155 | <template x-for="t in themes">
|
151 |
| - <option x-bind:value="t.theme" x-text="t.theme" x-bind:selected="t.selected"></option> |
| 156 | + <option x-bind:value="t.name" x-text="t.name" x-bind:selected="t.selected"></option> |
152 | 157 | </template>
|
153 | 158 | </select>
|
154 | 159 | </div>
|
|
0 commit comments