resolve remote account when displaying it

This commit is contained in:
Nicolas Constant 2018-10-31 00:27:25 -04:00
parent fa4f1f235f
commit 4825aa53d0
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
2 changed files with 7 additions and 1 deletions

View File

@ -71,7 +71,7 @@ export class StreamOverlayComponent implements OnInit {
return;
}
this.mastodonService.search(selectedAccounts[0], accountName)
this.mastodonService.search(selectedAccounts[0], accountName, true)
.then((result: Results) => {
this.account = result.accounts[0];
});

View File

@ -117,6 +117,12 @@ export class MastodonService {
return this.httpClient.get<Results>(route, { headers: headers }).toPromise()
}
searchAccount(account: AccountInfo, query: string, limit: number = 40, following: boolean = false): Promise<Account[]>{
const route = `https://${account.instance}${this.apiRoutes.searchForAccounts}?q=${query}&limit=${limit}&following=${following}`;
const headers = new HttpHeaders({ 'Authorization': `Bearer ${account.token.access_token}` });
return this.httpClient.get<Account[]>(route, { headers: headers }).toPromise()
}
reblog(account: AccountInfo, status: Status): Promise<Status> {
const route = `https://${account.instance}${this.apiRoutes.reblogStatus}`.replace('{0}', status.id);
const headers = new HttpHeaders({ 'Authorization': `Bearer ${account.token.access_token}` });