Add a widget to select a movement
This commit is contained in:
@ -50,10 +50,34 @@ export class MovementApi {
|
||||
/**
|
||||
* Get all the movements of an account
|
||||
*/
|
||||
static async GetAccountMovements(account_id: number): Promise<Movement[]> {
|
||||
static async GetAccountMovements(
|
||||
account_id: number,
|
||||
filters?: {
|
||||
amount_min?: number;
|
||||
amount_max?: number;
|
||||
time_min?: number;
|
||||
time_max?: number;
|
||||
label?: string;
|
||||
limit?: number;
|
||||
}
|
||||
): Promise<Movement[]> {
|
||||
let filtersS = new URLSearchParams();
|
||||
if (filters) {
|
||||
if (filters.amount_min)
|
||||
filtersS.append("amount_min", filters.amount_min.toString());
|
||||
if (filters.amount_max)
|
||||
filtersS.append("amount_max", filters.amount_max.toString());
|
||||
if (filters.time_min)
|
||||
filtersS.append("time_min", filters.time_min.toString());
|
||||
if (filters.time_max)
|
||||
filtersS.append("time_max", filters.time_max.toString());
|
||||
if (filters.label) filtersS.append("label", filters.label);
|
||||
if (filters.limit) filtersS.append("limit", filters.limit);
|
||||
}
|
||||
|
||||
return (
|
||||
await APIClient.exec({
|
||||
uri: `/account/${account_id}/movements`,
|
||||
uri: `/account/${account_id}/movements?${filtersS}`,
|
||||
method: "GET",
|
||||
})
|
||||
).data;
|
||||
|
Reference in New Issue
Block a user