profiles: retrieve friends on login
This commit is contained in:
parent
0127a22a46
commit
5c32d205c6
@ -15,11 +15,16 @@ class MyProfile extends Profile
|
||||
* @type {[Profile]}
|
||||
*/
|
||||
this.blockedUsers = [];
|
||||
/**
|
||||
* @type {[Profile]}
|
||||
*/
|
||||
this.friends = [];
|
||||
}
|
||||
|
||||
async init() {
|
||||
await super.init();
|
||||
await this.getBlockedUsers();
|
||||
await this.getFriends();
|
||||
}
|
||||
|
||||
async getBlockedUsers() {
|
||||
@ -28,6 +33,11 @@ class MyProfile extends Profile
|
||||
data.forEach(profileData => this.blockedUsers.push(new Profile(this.client, profileData.username, profileData.user_id, profileData.avatar)));
|
||||
}
|
||||
|
||||
async getFriends() {
|
||||
const response = await this.client._get('/api/profiles/friends');
|
||||
const data = await response.json();
|
||||
data.forEach(profileData => this.friends.push(new Profile(this.client, profileData.username, profileData.user_id, profileData.avatar)));
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {File} selectedFile
|
||||
|
Loading…
Reference in New Issue
Block a user