diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-05-05 08:03:29 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-05-06 22:17:18 +0900 |
commit | a0882bbceb7ed71d56bf8557620449fbc3f19749 (patch) | |
tree | f2087d44f21dd68fc3584f62cfb9b62ae58bab2b /src/background/usecases/SettingUseCase.ts | |
parent | d01db82c0dca352de2d7644c383d388fc3ec0366 (diff) |
Declare setting types
Diffstat (limited to 'src/background/usecases/SettingUseCase.ts')
-rw-r--r-- | src/background/usecases/SettingUseCase.ts | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/background/usecases/SettingUseCase.ts b/src/background/usecases/SettingUseCase.ts index b66ce02..aa3b534 100644 --- a/src/background/usecases/SettingUseCase.ts +++ b/src/background/usecases/SettingUseCase.ts @@ -1,7 +1,8 @@ -import Setting from '../domains/Setting'; // eslint-disable-next-line max-len import PersistentSettingRepository from '../repositories/PersistentSettingRepository'; import SettingRepository from '../repositories/SettingRepository'; +import { DefaultSettingData } from '../../shared/SettingData'; +import Settings from '../../shared/Settings'; export default class SettingUseCase { private persistentSettingRepository: PersistentSettingRepository; @@ -13,20 +14,18 @@ export default class SettingUseCase { this.settingRepository = new SettingRepository(); } - get(): Promise<any> { + get(): Promise<Settings> { return this.settingRepository.get(); } - async reload(): Promise<any> { - let settings = await this.persistentSettingRepository.load(); - if (!settings) { - settings = Setting.defaultSettings(); + async reload(): Promise<Settings> { + let data = await this.persistentSettingRepository.load(); + if (!data) { + data = DefaultSettingData; } - let value = settings.value(); - + let value = data.toSettings(); this.settingRepository.update(value); - return value; } } |