aboutsummaryrefslogtreecommitdiff
path: root/src/content/usecases/SettingUseCase.ts
blob: 4608039a58316479c4f30aecdf88bac5843c66a3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { injectable, inject } from 'tsyringe';
import SettingRepository from '../repositories/SettingRepository';
import SettingClient from '../client/SettingClient';
import Settings from '../../shared/settings/Settings';

@injectable()
export default class SettingUseCase {
  constructor(
    @inject('SettingRepository') private repository: SettingRepository,
    @inject('SettingClient') private client: SettingClient,
  ) {
  }

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