From 32b04696d2c29377ee7edef1183214ff1837383b Mon Sep 17 00:00:00 2001 From: James Chien Date: Wed, 13 Mar 2024 14:40:54 +0800 Subject: [PATCH 1/2] feat(ActionService): add query param sort_field=index to sort network actions Signed-off-by: James Chien --- src/app/shared/actions/service/actions.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/shared/actions/service/actions.service.ts b/src/app/shared/actions/service/actions.service.ts index 8076937f3..b1db79e57 100644 --- a/src/app/shared/actions/service/actions.service.ts +++ b/src/app/shared/actions/service/actions.service.ts @@ -14,7 +14,9 @@ export class ActionsService { getActions$() { return defer(() => this.httpClient - .get>(`${BUBBLE_DB_URL}/api/1.1/obj/action`) + .get>( + `${BUBBLE_DB_URL}/api/1.1/obj/action?sort_field=index` + ) .pipe(map(response => response.response.results)) ); } From 55f28f7b986d361c2d89a37f0d79567e715afff9 Mon Sep 17 00:00:00 2001 From: James Chien Date: Wed, 13 Mar 2024 15:31:14 +0800 Subject: [PATCH 2/2] refactor(ActionService): use HttpParams Signed-off-by: James Chien --- src/app/shared/actions/service/actions.service.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/shared/actions/service/actions.service.ts b/src/app/shared/actions/service/actions.service.ts index b1db79e57..725952f01 100644 --- a/src/app/shared/actions/service/actions.service.ts +++ b/src/app/shared/actions/service/actions.service.ts @@ -1,4 +1,4 @@ -import { HttpClient } from '@angular/common/http'; +import { HttpClient, HttpParams } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { defer, forkJoin, of } from 'rxjs'; import { map } from 'rxjs/operators'; @@ -12,10 +12,12 @@ export class ActionsService { constructor(private readonly httpClient: HttpClient) {} getActions$() { + const params = new HttpParams({ fromObject: { sort_field: 'index' } }); return defer(() => this.httpClient .get>( - `${BUBBLE_DB_URL}/api/1.1/obj/action?sort_field=index` + `${BUBBLE_DB_URL}/api/1.1/obj/action`, + { params } ) .pipe(map(response => response.response.results)) );