1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-12-16 11:37:13 +02:00
pigallery2/frontend/app/settings/database/database.settings.service.ts
2017-07-13 23:39:09 +02:00

22 lines
813 B
TypeScript

import {Injectable} from "@angular/core";
import {NetworkService} from "../../model/network/network.service";
import {DataBaseConfig, IPrivateConfig} from "../../../../common/config/private/IPrivateConfig";
@Injectable()
export class DatabaseSettingsService {
constructor(private _networkService: NetworkService) {
}
public async getSettings(): Promise<DataBaseConfig> {
return (await <Promise<IPrivateConfig>>this._networkService.getJson("/settings")).Server.database;
}
public updateSettings(settings: DataBaseConfig): Promise<void> {
return this._networkService.putJson("/settings/database", {settings: settings});
}
public testSettings(settings: DataBaseConfig): Promise<void> {
return this._networkService.postJson<void>("/settings/test/database", {settings: settings});
}
}