aboutsummaryrefslogtreecommitdiffstats
path: root/src/models/Settings.js
blob: 87ab8de67ae8933ab1315a4cb110d784a7860f19 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { observable, extendObservable } from 'mobx';
import { DEFAULT_APP_SETTINGS } from '../config';

export default class Settings {
  @observable app = DEFAULT_APP_SETTINGS

  @observable proxy = {}

  @observable service = {
    activeService: '',
  }

  @observable stats = {
    appStarts: 0,
  }

  @observable migration = {}

  constructor({ app, proxy, service, stats, migration }) {
    Object.assign(this.app, app);
    Object.assign(this.proxy, proxy);
    Object.assign(this.service, service);
    Object.assign(this.stats, stats);
    Object.assign(this.migration, migration);
  }

  update(data) {
    extendObservable(this, data);
  }
}