Web:Common:Add onSaveSelectedNewThemes.

This commit is contained in:
Vlada Gazizova 2022-10-30 16:40:20 +03:00
parent e7b858373a
commit 2facf7fa7c

View File

@ -687,6 +687,26 @@ class SettingsStore {
this.setCurrentColorScheme(currentColorScheme);
};
onSaveSelectedNewThemes = async (
newCustomThemes,
selectNewThemeId,
arrLengthBeforeChange
) => {
let newAppearanceTheme = [];
await this.sendAppearanceTheme({ themes: newCustomThemes });
await api.settings.getAppearanceTheme().then((res) => {
newAppearanceTheme = res.themes;
});
const customThemes = newAppearanceTheme.slice(arrLengthBeforeChange);
const selectTheme = customThemes[selectNewThemeId - 1];
await this.sendAppearanceTheme({ selected: selectTheme.id });
await this.getAppearanceTheme();
};
sendAppearanceTheme = async (data) => {
return api.settings.sendAppearanceTheme(data);
};