Files
psp_panel/src/app/domains/partner/modules/accounts/services/main.service.ts
T
2026-04-13 15:47:50 +03:30

25 lines
993 B
TypeScript

import { IPaginatedResponse } from '@/core/models/service.model';
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { PARTNER_ACCOUNTS_API_ROUTES } from '../constants';
import { IAccountRawResponse, IAccountRequest, IAccountResponse } from '../models';
@Injectable({ providedIn: 'root' })
export class AccountsService {
constructor(private http: HttpClient) {}
private apiRoutes = PARTNER_ACCOUNTS_API_ROUTES;
getAll(): Observable<IPaginatedResponse<IAccountResponse>> {
return this.http.get<IPaginatedResponse<IAccountRawResponse>>(this.apiRoutes.list());
}
getSingle(accountId: string): Observable<IAccountResponse> {
return this.http.get<IAccountRawResponse>(this.apiRoutes.single(accountId));
}
update(accountId: string, userData: IAccountRequest): Observable<IAccountResponse> {
return this.http.patch<IAccountResponse>(this.apiRoutes.single(accountId), userData);
}
}