Unverified Commit d8b6227b authored by ζ‹·ι’‰'s avatar ζ‹·ι’‰ Committed by GitHub

Update setting.ts

parent 3916692c
...@@ -104,7 +104,7 @@ const SettingModel: SettingModelType = { ...@@ -104,7 +104,7 @@ const SettingModel: SettingModelType = {
}); });
const { primaryColor, colorWeak } = setting; const { primaryColor, colorWeak } = setting;
if (state.primaryColor !== primaryColor) { if (primaryColor && state.primaryColor !== primaryColor) {
updateTheme(primaryColor); updateTheme(primaryColor);
} }
updateColorWeak(!!colorWeak); updateColorWeak(!!colorWeak);
...@@ -133,13 +133,13 @@ const SettingModel: SettingModelType = { ...@@ -133,13 +133,13 @@ const SettingModel: SettingModelType = {
} }
}); });
const { primaryColor, colorWeak, contentWidth } = payload; const { primaryColor, colorWeak, contentWidth } = payload;
if (state.primaryColor !== primaryColor) { if (primaryColor && state.primaryColor !== primaryColor) {
updateTheme(primaryColor); updateTheme(primaryColor);
} }
if (state.contentWidth !== contentWidth && window.dispatchEvent) { if (state.contentWidth !== contentWidth && window.dispatchEvent) {
window.dispatchEvent(new Event('resize')); window.dispatchEvent(new Event('resize'));
} }
updateColorWeak(colorWeak); updateColorWeak(!!colorWeak);
window.history.replaceState(null, 'setting', urlParams.href); window.history.replaceState(null, 'setting', urlParams.href);
return { return {
...state, ...state,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment