matrix-dimension/web/app/shared/services/admin/admin-api.service.ts

28 lines
932 B
TypeScript
Raw Normal View History

import { Injectable } from "@angular/core";
import { AuthedApi } from "../authed-api";
import { FE_DimensionConfig, FE_DimensionVersion } from "../../models/admin-responses";
2019-06-29 02:21:56 -04:00
import { HttpClient } from "@angular/common/http";
@Injectable()
export class AdminApiService extends AuthedApi {
2019-06-29 02:21:56 -04:00
constructor(http: HttpClient) {
super(http);
}
public isAdmin(): Promise<any> {
2019-06-29 02:21:56 -04:00
return this.authedGet("/api/v1/dimension/admin/check").toPromise();
}
public getConfig(): Promise<FE_DimensionConfig> {
2019-06-29 02:21:56 -04:00
return this.authedGet<FE_DimensionConfig>("/api/v1/dimension/admin/config").toPromise();
}
public getVersion(): Promise<FE_DimensionVersion> {
2019-06-29 02:21:56 -04:00
return this.authedGet<FE_DimensionVersion>("/api/v1/dimension/admin/version").toPromise();
}
2019-03-12 21:08:12 -04:00
public logoutAll(): Promise<any> {
2019-06-29 02:21:56 -04:00
return this.authedPost("/api/v1/dimension/admin/sessions/logout/all").toPromise();
2019-03-12 21:08:12 -04:00
}
}