35 lines
727 B
JavaScript
35 lines
727 B
JavaScript
class Profile
|
|
{
|
|
constructor (client, username = undefined, avatar_url = undefined, user_id = undefined)
|
|
{
|
|
this.client = client;
|
|
this.username = username;
|
|
this.avatar_url = avatar_url
|
|
this.user_id = user_id
|
|
}
|
|
|
|
async init(user_id)
|
|
{
|
|
let response = await this.client._get(`/api/profiles/${user_id}`);
|
|
let response_data = await response.json();
|
|
|
|
this.user_id = user_id;
|
|
this.username = response_data.username;
|
|
this.avatar_url = response_data.avatar_url;
|
|
}
|
|
|
|
async change_avatar(form_data)
|
|
{
|
|
let response = await this.client._patch_file(`/api/profiles/${this.user_id}`, form_data);
|
|
let response_data = await response.json()
|
|
|
|
return response_data;
|
|
}
|
|
|
|
async setData (data)
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
export {Profile} |