profiles(block): get profiles of blocked users

This commit is contained in:
AdrienLSH
2024-04-07 17:43:30 +02:00
parent 8912e39fa4
commit 80e7335c8d
4 changed files with 40 additions and 47 deletions

View File

@ -10,6 +10,22 @@ class MyProfile extends Profile
constructor (client)
{
super(client, "../me");
/**
* @type {[Profile]}
*/
this.blockedUsers = [];
}
async init() {
await super.init();
await this.getBlockedUsers();
}
async getBlockedUsers() {
const response = await this.client._get('/api/profiles/block');
const data = await response.json();
data.forEach(profileData => this.blockedUsers.push(new Profile(this.client, profileData.username, profileData.user_id, profileData.avatar)));
}
/**