Shared services
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
This commit is contained in:
34
projects/common/src/fm/services/user-data.service.ts
Normal file
34
projects/common/src/fm/services/user-data.service.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AppConfig, IUser } from '@farmmaps/common';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class UserDataService {
|
||||
constructor(
|
||||
public httpClient: HttpClient,
|
||||
public appConfig: AppConfig) {
|
||||
}
|
||||
|
||||
ApiEndpoint() {
|
||||
return this.appConfig.getConfig('apiEndPoint');
|
||||
}
|
||||
|
||||
loadUserNotifications(): Observable<any> {
|
||||
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/notifications`);
|
||||
}
|
||||
|
||||
readUserNotification(notificationCode: string): Observable<any> {
|
||||
return this.httpClient.put<any>(`${this.ApiEndpoint()}/api/v1/notifications/${notificationCode}`, null);
|
||||
}
|
||||
|
||||
deleteUserNotification(notificationCode: string): Observable<any> {
|
||||
return this.httpClient.delete<any>(`${this.ApiEndpoint()}/api/v1/notifications/${notificationCode}`);
|
||||
}
|
||||
|
||||
getUserConnections(userCode: string, active: boolean): Observable<IUser[]> {
|
||||
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/users/${userCode}/connections?active=${active}`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user