aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/instance
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/instance')
-rw-r--r--client/src/app/shared/instance/follow.service.ts22
1 files changed, 19 insertions, 3 deletions
diff --git a/client/src/app/shared/instance/follow.service.ts b/client/src/app/shared/instance/follow.service.ts
index 63f9e2687..1477a26ae 100644
--- a/client/src/app/shared/instance/follow.service.ts
+++ b/client/src/app/shared/instance/follow.service.ts
@@ -2,7 +2,7 @@ import { catchError, map } from 'rxjs/operators'
2import { HttpClient, HttpParams } from '@angular/common/http' 2import { HttpClient, HttpParams } from '@angular/common/http'
3import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
4import { Observable } from 'rxjs' 4import { Observable } from 'rxjs'
5import { ActorFollow, ResultList } from '@shared/index' 5import { ActorFollow, FollowState, ResultList } from '@shared/index'
6import { environment } from '../../../environments/environment' 6import { environment } from '../../../environments/environment'
7import { RestExtractor, RestPagination, RestService } from '../rest' 7import { RestExtractor, RestPagination, RestService } from '../rest'
8import { SortMeta } from 'primeng/api' 8import { SortMeta } from 'primeng/api'
@@ -18,11 +18,19 @@ export class FollowService {
18 ) { 18 ) {
19 } 19 }
20 20
21 getFollowing (pagination: RestPagination, sort: SortMeta, search?: string): Observable<ResultList<ActorFollow>> { 21 getFollowing (options: {
22 pagination: RestPagination,
23 sort: SortMeta,
24 search?: string,
25 state?: FollowState
26 }): Observable<ResultList<ActorFollow>> {
27 const { pagination, sort, search, state } = options
28
22 let params = new HttpParams() 29 let params = new HttpParams()
23 params = this.restService.addRestGetParams(params, pagination, sort) 30 params = this.restService.addRestGetParams(params, pagination, sort)
24 31
25 if (search) params = params.append('search', search) 32 if (search) params = params.append('search', search)
33 if (state) params = params.append('state', state)
26 34
27 return this.authHttp.get<ResultList<ActorFollow>>(FollowService.BASE_APPLICATION_URL + '/following', { params }) 35 return this.authHttp.get<ResultList<ActorFollow>>(FollowService.BASE_APPLICATION_URL + '/following', { params })
28 .pipe( 36 .pipe(
@@ -31,11 +39,19 @@ export class FollowService {
31 ) 39 )
32 } 40 }
33 41
34 getFollowers (pagination: RestPagination, sort: SortMeta, search?: string): Observable<ResultList<ActorFollow>> { 42 getFollowers (options: {
43 pagination: RestPagination,
44 sort: SortMeta,
45 search?: string,
46 state?: FollowState
47 }): Observable<ResultList<ActorFollow>> {
48 const { pagination, sort, search, state } = options
49
35 let params = new HttpParams() 50 let params = new HttpParams()
36 params = this.restService.addRestGetParams(params, pagination, sort) 51 params = this.restService.addRestGetParams(params, pagination, sort)
37 52
38 if (search) params = params.append('search', search) 53 if (search) params = params.append('search', search)
54 if (state) params = params.append('state', state)
39 55
40 return this.authHttp.get<ResultList<ActorFollow>>(FollowService.BASE_APPLICATION_URL + '/followers', { params }) 56 return this.authHttp.get<ResultList<ActorFollow>>(FollowService.BASE_APPLICATION_URL + '/followers', { params })
41 .pipe( 57 .pipe(