Currently, I am developing a frontend application for a project using Angular 4. From the backend, I receive some POST actions that are listed in a file called actions.response.ts:
actions.response.ts
export class actions{
AGREEMENTS_VIEW :string;
PROSPECTS_VIEW :string;
AGREEMENTS_INSERT_UPDATE :string;
PRODUCTS_INSERT_UPDATE :string;
PROSPECTS_INSERT_UPDATE :string;
DOCUMENTS_VIEW :string;
DOCUMENTS_INSERT_UPDATE :string;
}
My goal is to enable or disable components, inputs, selects, or buttons based on each action (agreements_view, prospects_view, etc). How can I achieve this?
HTTP POST request:
securityActions(): Observable<actions> {
return this.http.post<actions>(
`${this.ENDPOINT}/security-actions`,
null,
);
}
How I call the POST request within the component:
securityActions() {
this.securityService.securityActions().subscribe(
(res: actions) => {
this.actionsSecurity = res;
console.log(res);
},
errors => {
Utils.notifyErrors(errors, this.notificationsService);
});
}
I apologize if my question seems basic, but I am new to Angular and feeling a bit overwhelmed!