Shared services
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit

This commit is contained in:
2026-02-23 15:22:32 +01:00
parent 5e84eb4404
commit 18092fcc24
8 changed files with 194 additions and 5 deletions

View 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}`);
}
}