Skip to content

Commit

Permalink
fix(store): fix "strict" warning
Browse files Browse the repository at this point in the history
  • Loading branch information
ph1p committed Mar 11, 2021
1 parent ca69c30 commit 9f9a294
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
18 changes: 17 additions & 1 deletion src/store/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ import { sendMainMessage } from '../shared/utils';

import MessageSound from '../assets/sound.mp3';

interface StoreSettings {
name: string;
avatar: string;
color: string;
url: string;
enableNotificationTooltip: boolean;
enableNotificationSound: boolean;
isDarkTheme: boolean;
}
class RootStore {
constructor() {
makeAutoObservable(this);
Expand Down Expand Up @@ -82,7 +91,7 @@ class RootStore {

isMinimized = false;

settings = {
settings: StoreSettings = {
name: '',
avatar: '',
color: '#4F4F4F',
Expand All @@ -94,6 +103,13 @@ class RootStore {

notifications = [];

setSetting(key: keyof StoreSettings, value: string | boolean) {
this.settings = {
...this.settings,
[key]: value,
};
}

setIsMinimized(isMinimized: boolean) {
this.isMinimized = isMinimized;
}
Expand Down
6 changes: 4 additions & 2 deletions src/views/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,10 @@ const SettingsView: FunctionComponent = observer(() => {
name="bell"
ref={ref}
onClick={() => {
store.settings.enableNotificationSound = !store.settings
.enableNotificationSound;
store.setSetting(
'enableNotificationSound',
!store.settings.enableNotificationSound
);
saveSettings(false);
}}
>
Expand Down

0 comments on commit 9f9a294

Please sign in to comment.