aboutsummaryrefslogtreecommitdiff
path: root/src/content/usecases/SettingUseCase.ts
blob: 765cb45693ac512635c10639866e7605785089a5 (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
import SettingRepository, { SettingRepositoryImpl }
  from '../repositories/SettingRepository';
import SettingClient, { SettingClientImpl } from '../client/SettingClient';
import Settings from '../../shared/Settings';

export default class SettingUseCase {
  private repository: SettingRepository;

  private client: SettingClient;

  constructor({
    repository = new SettingRepositoryImpl(),
    client = new SettingClientImpl(),
  } = {}) {
    this.repository = repository;
    this.client = client;
  }

  async reload(): Promise<Settings> {
    let settings = await this.client.load();
    this.repository.set(settings);
    return settings;
  }
}