revert _
This commit is contained in:
adrien-lsh
2024-04-19 06:43:12 +00:00
parent 6b82f00a14
commit 9bc3092a0e
5 changed files with 74 additions and 13 deletions

View File

@ -19,12 +19,22 @@ class MyProfile extends Profile
* @type {[Profile]}
*/
this.friends = [];
/**
* @type {[Profile]}
*/
this.incomingFriendRequests = [];
/**
* @type {[Profile]}
*/
this.outgoingFriendRequests = [];
}
async init() {
await super.init();
await this.getBlockedUsers();
await this.getFriends();
await this.getIncomingFriendRequests()
await this.getOutgoingFriendRequests()
}
async getBlockedUsers() {
@ -38,6 +48,20 @@ class MyProfile extends Profile
const data = await response.json();
data.forEach(profileData => this.friends.push(new Profile(this.client, profileData.username, profileData.user_id, profileData.avatar)));
}
async getIncomingFriendRequests() {
const response = await this.client._get('/api/profiles/incoming_friend_requests');
const data = await response.json();
data.forEach(profileData => this.incomingFriendRequests.push(
new Profile(this.client, profileData.username, profileData.user_id, profileData.avatar)
));
}
async getOutgoingFriendRequests() {
const response = await this.client._get('/api/profiles/outgoing_friend_requests');
const data = await response.json();
data.forEach(profileData => this.outgoingFriendRequests.push(
new Profile(this.client, profileData.username, profileData.user_id, profileData.avatar)
));
}
/**
*
* @param {File} selectedFile

View File

@ -1,4 +1,4 @@
import {client, navigateTo} from "../../index.js";
import {client} from "../../index.js";
import AbstractAuthenticatedView from "../abstracts/AbstractAuthenticatedView.js";
export default class extends AbstractAuthenticatedView
@ -39,10 +39,6 @@ export default class extends AbstractAuthenticatedView
// name
let td = document.createElement("td");
td.innerText = tournament.name;
td.onclick = () => {
navigateTo("tournaments/" + tournament.id);
}
tr.appendChild(td);
// state