aboutsummaryrefslogtreecommitdiff
path: root/src/content/usecases/SettingUseCase.ts
blob: 67d1be6f2353add2168d3b10d74334d1d49f8211 (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> {
    const settings = await this.client.load();
    this.repository.set(settings);
    return settings;
  }
}