blob: b66ce025a8a0b3b10a7af18063fb5a0357f8287e (
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
31
32
|
import Setting from '../domains/Setting';
// eslint-disable-next-line max-len
import PersistentSettingRepository from '../repositories/PersistentSettingRepository';
import SettingRepository from '../repositories/SettingRepository';
export default class SettingUseCase {
private persistentSettingRepository: PersistentSettingRepository;
private settingRepository: SettingRepository;
constructor() {
this.persistentSettingRepository = new PersistentSettingRepository();
this.settingRepository = new SettingRepository();
}
get(): Promise<any> {
return this.settingRepository.get();
}
async reload(): Promise<any> {
let settings = await this.persistentSettingRepository.load();
if (!settings) {
settings = Setting.defaultSettings();
}
let value = settings.value();
this.settingRepository.update(value);
return value;
}
}
|