feat: add pagination support for user transactions retrieval
This commit is contained in:
parent
9817fb95db
commit
03d67ef362
6 changed files with 92 additions and 17 deletions
|
@ -7,11 +7,15 @@ import { HttpClient } from '@angular/common/http';
|
|||
export class TransactionService {
|
||||
private http: HttpClient = inject(HttpClient);
|
||||
|
||||
public getUsersTransactions(limit: number|null = null) {
|
||||
const baseUrl = '/backend/user/transactions';
|
||||
public getUsersTransactions(limit: number|null = null, offset: number|null = null) {
|
||||
let baseUrl = new URL(`${window.location.origin}/backend/user/transactions`);
|
||||
|
||||
if (limit !== null) {
|
||||
return this.http.get<any[]>(`${baseUrl}?limit=${limit}`);
|
||||
baseUrl.searchParams.append('limit', limit.toString());
|
||||
}
|
||||
|
||||
if (offset !== null) {
|
||||
baseUrl.searchParams.append('offset', offset.toString());
|
||||
}
|
||||
|
||||
return this.http.get<any[]>(`${baseUrl}`);
|
||||
|
|
Reference in a new issue