2018-09-24 12:08:33 +02:00
|
|
|
import {Injectable} from '@angular/core';
|
2019-06-03 15:20:36 +02:00
|
|
|
import {HttpClient, HttpErrorResponse} from "@angular/common/http";
|
2020-11-12 16:41:03 +01:00
|
|
|
import {throwError} from 'rxjs';
|
2018-11-08 14:49:40 +01:00
|
|
|
import { CustomOptions } from '../../services/servicesUtils/customOptions.class';
|
2018-09-24 12:08:33 +02:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class MailPrefsService {
|
2019-06-03 15:20:36 +02:00
|
|
|
constructor(private http: HttpClient ) {}
|
2018-09-24 12:08:33 +02:00
|
|
|
|
|
|
|
getUserEmailPreferencesForCommunity (communityId:string, apiUrl:string):any {
|
2022-06-28 20:13:40 +02:00
|
|
|
return this.http.get(apiUrl +"users/notification"+"?communityId="+communityId, CustomOptions.getAuthOptions())
|
2018-09-24 12:08:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
getUserEmailPreferencesForOpenaire (apiUrl:string):any {
|
2022-06-28 20:13:40 +02:00
|
|
|
return this.http.get(apiUrl +"users/notification", CustomOptions.getAuthOptions());
|
2018-09-24 12:08:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
saveUserEmailPreferences (notification: any, apiUrl: string) {
|
2022-06-28 20:13:40 +02:00
|
|
|
let body = JSON.stringify(notification);
|
|
|
|
return this.http.post(apiUrl +"users/notification/save", body, CustomOptions.getAuthOptionsWithBody());
|
2018-09-24 12:08:33 +02:00
|
|
|
}
|
|
|
|
}
|