matrix-dimension/web/app/shared/services/admin/admin-terms-api.service.ts
2019-07-04 22:55:13 -06:00

20 lines
760 B
TypeScript

import { Injectable } from "@angular/core";
import { AuthedApi } from "../authed-api";
import { HttpClient } from "@angular/common/http";
import { FE_TermsEditable } from "../../models/terms";
@Injectable()
export class AdminTermsApiService extends AuthedApi {
constructor(http: HttpClient) {
super(http, true);
}
public getAllPolicies(): Promise<FE_TermsEditable[]> {
return this.authedGet<FE_TermsEditable[]>("/api/v1/dimension/admin/terms/all").toPromise();
}
public createDraft(shortcode: string, policyInfo: { name: string, text: string, url: string }): Promise<FE_TermsEditable> {
return this.authedPost<FE_TermsEditable>(`/api/v1/dimension/admin/terms/${shortcode}/draft`, policyInfo).toPromise();
}
}