[Trunk | Library]: subscribe.service.ts: Method "isSubscribedToCommunity()":

a. get request, not post.
        b. Method "getCommunitiesSubscribedTo()" remove email parameter and add token in header ("X-XSRF-TOKEN" header) - Do not reveal user's email.


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58461 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2020-04-10 06:09:15 +00:00
parent 71a4d35c43
commit 9433f3b350
1 changed files with 4 additions and 4 deletions

View File

@ -23,7 +23,7 @@ export class SubscribeService {
isSubscribedToCommunity(properties: EnvProperties, pid: string) {
let url = properties.adminToolsAPIURL + "/community/" + pid + "/is-subscriber/";
return this.http.post<boolean>(url, {}, CustomOptions.getAuthOptionsWithBody())
return this.http.get<boolean>(url, CustomOptions.getAuthOptionsWithBody())
.pipe(map(res => {
// if (res['status'] && res['status'] != 200) {
// return null;
@ -58,8 +58,8 @@ export class SubscribeService {
return this.http.post<any>(properties.adminToolsAPIURL + "/community/" + pid + "/subscribers/delete", JSON.stringify([email]), CustomOptions.getAuthOptionsWithBody());
}
getCommunitiesSubscribedTo(properties: EnvProperties, email: string) {
let url = properties.adminToolsAPIURL + "/subscriber/communities?email=" + email;
return this.http.get<any>((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url);
getCommunitiesSubscribedTo(properties: EnvProperties/*, email: string*/) {
let url = properties.adminToolsAPIURL + "/subscriber/communities";//?email=" + email;
return this.http.get<any>(url, CustomOptions.getAuthOptionsWithBody());
}
}