aboutsummaryrefslogtreecommitdiff
path: root/src/content/usecases/SettingUseCase.ts
blob: b2b24aa2d8e9e54cea34f58c36a9cf368e264038 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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;
  }
}