29 lines
849 B
JavaScript
29 lines
849 B
JavaScript
|
import AbstractView from "../AbstractView.js";
|
||
|
import { client } from "../../index.js"
|
||
|
|
||
|
export default class extends AbstractView {
|
||
|
constructor(params) {
|
||
|
super(params, "Profile ");
|
||
|
this.user_id = params.id;
|
||
|
}
|
||
|
|
||
|
async postInit()
|
||
|
{
|
||
|
let profile = await client.profiles.getProfile(this.user_id);
|
||
|
|
||
|
let username_element = document.getElementById("username");
|
||
|
username_element.href = `/profiles/${this.user_id}`;
|
||
|
username_element.appendChild(document.createTextNode(profile.username));
|
||
|
|
||
|
let avatar_element = document.getElementById("avatar");
|
||
|
avatar_element.src = profile.avatar_url;
|
||
|
}
|
||
|
|
||
|
async getHtml() {
|
||
|
return `
|
||
|
<link rel="stylesheet" href="/static/css/profiles/profile.css">
|
||
|
<img id="avatar"/>
|
||
|
<a id="username"></a>
|
||
|
`;
|
||
|
}
|
||
|
}
|