Skip to content

Commit 3036608

Browse files
committed
Add update() method to NewsroomThemes client
Sends PATCH (instead of POST like apply()) to save theme settings without activating the theme.
1 parent e0602ce commit 3036608

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/endpoints/NewsroomThemes/Client.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,23 @@ export function createClient(api: DeferredJobsApiClient) {
4141
return themes;
4242
}
4343

44+
async function update(
45+
newsroomId: NewsroomId,
46+
themeId: NewsroomThemeId,
47+
settings: NewsroomThemePreset['settings'],
48+
): Promise<NewsroomThemePreset> {
49+
const url = routing.newsroomThemesUrl.replace(':newsroom_id', String(newsroomId));
50+
const { theme } = await api.patch<{ theme: NewsroomThemePreset }>(`${url}/${themeId}`, {
51+
payload: settings,
52+
});
53+
return theme;
54+
}
55+
4456
return {
4557
apply,
4658
get,
4759
getActive,
4860
list,
61+
update,
4962
};
5063
}

0 commit comments

Comments
 (0)