fix: check if profile existe befort render profile page
This commit is contained in:
@ -19,6 +19,10 @@ class Profile
|
||||
async init(user_id)
|
||||
{
|
||||
let response = await this.client._get(`/api/profiles/${user_id}`);
|
||||
|
||||
if (response.status === 404)
|
||||
return 1;
|
||||
|
||||
let response_data = await response.json();
|
||||
|
||||
this.user_id = response_data.user_id;
|
||||
|
@ -28,7 +28,8 @@ class Profiles
|
||||
async getProfile(user_id)
|
||||
{
|
||||
let profile = new Profile(this.client);
|
||||
await profile.init(user_id);
|
||||
if (await profile.init(user_id))
|
||||
return null;
|
||||
return profile;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user