mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-27 01:43:08 +02:00
chore: change style of getStatusTrends
This commit is contained in:
parent
0a9ca195e2
commit
171ba6f4f5
1 changed files with 4 additions and 7 deletions
|
@ -47,8 +47,7 @@ export class ApiSearchMastodon {
|
||||||
|
|
||||||
public async getStatusTrends() {
|
public async getStatusTrends() {
|
||||||
try {
|
try {
|
||||||
let map;
|
const data = await fetch(`${this.BASE_URL}/api/notes/featured`,
|
||||||
await fetch(`${this.BASE_URL}/api/notes/featured`,
|
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -58,10 +57,8 @@ export class ApiSearchMastodon {
|
||||||
body: JSON.stringify({}),
|
body: JSON.stringify({}),
|
||||||
})
|
})
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then((data) => {
|
.then(data => data.map((status: any) => this.mastoConverter.convertStatus(status)));
|
||||||
map = data.map((status: any) => this.mastoConverter.convertStatus(status));
|
return data;
|
||||||
});
|
|
||||||
return map;
|
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
return [];
|
return [];
|
||||||
|
@ -82,7 +79,7 @@ export class ApiSearchMastodon {
|
||||||
return Promise.all(data.map(async (suggestion: any) => { suggestion.account = await this.mastoConverter.convertAccount(suggestion.account); return suggestion; }));
|
return Promise.all(data.map(async (suggestion: any) => { suggestion.account = await this.mastoConverter.convertAccount(suggestion.account); return suggestion; }));
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
return e.response.data;
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue