diff options
Diffstat (limited to 'client/src/app/shared/shared-instance')
-rw-r--r-- | client/src/app/shared/shared-instance/instance-follow.service.ts | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/client/src/app/shared/shared-instance/instance-follow.service.ts b/client/src/app/shared/shared-instance/instance-follow.service.ts index e52660140..af44020cf 100644 --- a/client/src/app/shared/shared-instance/instance-follow.service.ts +++ b/client/src/app/shared/shared-instance/instance-follow.service.ts | |||
@@ -4,7 +4,7 @@ import { catchError, map } from 'rxjs/operators' | |||
4 | import { HttpClient, HttpParams } from '@angular/common/http' | 4 | import { HttpClient, HttpParams } from '@angular/common/http' |
5 | import { Injectable } from '@angular/core' | 5 | import { Injectable } from '@angular/core' |
6 | import { RestExtractor, RestPagination, RestService } from '@app/core' | 6 | import { RestExtractor, RestPagination, RestService } from '@app/core' |
7 | import { ActivityPubActorType, ActorFollow, FollowState, ResultList } from '@shared/models' | 7 | import { ActivityPubActorType, ActorFollow, FollowState, ResultList, ServerFollowCreate } from '@shared/models' |
8 | import { environment } from '../../../environments/environment' | 8 | import { environment } from '../../../environments/environment' |
9 | 9 | ||
10 | @Injectable() | 10 | @Injectable() |
@@ -64,9 +64,10 @@ export class InstanceFollowService { | |||
64 | ) | 64 | ) |
65 | } | 65 | } |
66 | 66 | ||
67 | follow (notEmptyHosts: string[]) { | 67 | follow (hostsOrHandles: string[]) { |
68 | const body = { | 68 | const body: ServerFollowCreate = { |
69 | hosts: notEmptyHosts | 69 | handles: hostsOrHandles.filter(v => v.includes('@')), |
70 | hosts: hostsOrHandles.filter(v => !v.includes('@')) | ||
70 | } | 71 | } |
71 | 72 | ||
72 | return this.authHttp.post(InstanceFollowService.BASE_APPLICATION_URL + '/following', body) | 73 | return this.authHttp.post(InstanceFollowService.BASE_APPLICATION_URL + '/following', body) |
@@ -77,7 +78,9 @@ export class InstanceFollowService { | |||
77 | } | 78 | } |
78 | 79 | ||
79 | unfollow (follow: ActorFollow) { | 80 | unfollow (follow: ActorFollow) { |
80 | return this.authHttp.delete(InstanceFollowService.BASE_APPLICATION_URL + '/following/' + follow.following.host) | 81 | const handle = follow.following.name + '@' + follow.following.host |
82 | |||
83 | return this.authHttp.delete(InstanceFollowService.BASE_APPLICATION_URL + '/following/' + handle) | ||
81 | .pipe( | 84 | .pipe( |
82 | map(this.restExtractor.extractDataBool), | 85 | map(this.restExtractor.extractDataBool), |
83 | catchError(res => this.restExtractor.handleError(res)) | 86 | catchError(res => this.restExtractor.handleError(res)) |